Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions PasswordChecker.py
Original file line number Diff line number Diff line change
@@ -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' )
48 changes: 48 additions & 0 deletions Practise.py
Original file line number Diff line number Diff line change
@@ -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)
115 changes: 115 additions & 0 deletions Strings.py
Original file line number Diff line number Diff line change
@@ -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"))