From 5726792d328ceaf268569226107e4e8007b1a92a Mon Sep 17 00:00:00 2001 From: Pasindu Ukwatta <52557884+PasinduUkwatta@users.noreply.github.com> Date: Tue, 2 Jun 2020 15:25:43 +0530 Subject: [PATCH 1/2] Practise --- Practise.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Practise.py diff --git a/Practise.py b/Practise.py new file mode 100644 index 0000000..d567d96 --- /dev/null +++ b/Practise.py @@ -0,0 +1,48 @@ +print('pasindu') +print('hello world') + + +name = input('whts is your name ?') + +print(name) +print(type(2+4)) +print(type(2-4)) +print(type(2*4)) +print(type(2%4)) +print(type(2/4)) #0.5 float number +print(9.9+1.1) +print(type(9.9+1.1)) + +print(2**4) + +print(16//2) + + +#MATH FUNCTIONS + +print(round(3.1)) +print(abs(-3.1)) + +#operator presendence + +print(20-3*4) +print(bin(100)) + +#this is the way to convert +print(int('0b1100100',2)) + +iq= 190 + +user_age =iq/4 + +print(user_age) + +#constats - write in capital letters +PI = 3.14 + + +a,b,c =1,2,3 + +print(a) +print(b) +print(c) \ No newline at end of file From 942f6c5b5ac3c249621a7eca561b9250f30ffa08 Mon Sep 17 00:00:00 2001 From: Pasindu Ukwatta <52557884+PasinduUkwatta@users.noreply.github.com> Date: Wed, 3 Jun 2020 11:08:24 +0530 Subject: [PATCH 2/2] Practice -Day 2 --- PasswordChecker.py | 10 ++++ Strings.py | 115 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 PasswordChecker.py create mode 100644 Strings.py diff --git a/PasswordChecker.py b/PasswordChecker.py new file mode 100644 index 0000000..78e6e92 --- /dev/null +++ b/PasswordChecker.py @@ -0,0 +1,10 @@ +name = input("what is your name ?") +password =input("what is your password???") + +password_lenght=len(password) +print(type(password_lenght)) + +star_password ="*" *password_lenght +print(star_password) + +print(f'hello {name} , your password is {star_password} , it has {password_lenght} letters long' ) \ No newline at end of file diff --git a/Strings.py b/Strings.py new file mode 100644 index 0000000..7811cba --- /dev/null +++ b/Strings.py @@ -0,0 +1,115 @@ +print(("hi hello there")) +print(type("hi hello there")) + +#we can use three single qutes for long string like paragraphs or essays +long_string = ''' + +wooow + +open + +qwwe +''' +print(long_string) + + +first_name = 'pasindu' +last_name = 'thiwanka' + +full_name = first_name+" "+last_name + +print(full_name) + + +#string concatanation + +print ('hello' +'pasindu') + + +print(type(str(100))) +#type Conversion +a =str(100) +b=int(a) +c=type(b) +print(c) + +#Escape SEquence + +weather = "it\'s a \"kind of\" sunny day " + +print(weather) + + +#Formated Strings + +name ='pasindu' +age = 24 +print('hi '+name+' your age is '+str(age)) + +#we can create formated string in adding f in the start +#this is a feature in python 3 +print(f'hi {name} . your {age} years old .') + +word ="hello world" + +print(word[0]) +print(word[6]) +print(word) + +#[start:stop:stepover] +print(word[3:7]) +print(word[0:11]) +print(word[0:11:2]) + +#start from the beginig and go till the end of the array +print(word[0:]) + +#start from the beginig and go untill the desired point + +print(word[:6]) + +#go from the step over + +print(word[::2]) + +#we can use negative values to get the values from the end + +print(word[-1]) + +#reverse the order of the string + +print(word[::-1]) + +#we cannot reasign the part of the string + +name ='pasindu' + +#name[2] = 'b' +#we should declare the whole string + +name ='thiwanka' +print(name) + +#length function + +greet ="good Morning!" + +print(len(greet)) +print(greet[:len(greet)]) + +#string methods + +quote= "welcome to the python programming" +#conver all to the upper case +print(quote.upper()) + +#this will set the first letter captial letter +print(quote.capitalize()) + +#find the first occurence +print(quote.find("to")) + + + + +