-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathex5Revision.py
58 lines (41 loc) · 1.24 KB
/
ex5Revision.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#formatted Strings
# ""
# denotes a format sequence inside a string
myEyes = 'Blue'
myNose = 'Beautiful'
myLips = 'Rosy'
mySmile = 'Killing'
meriAdaa = 'sufi'
myAge =22
myHeight = 56
myName = "Awesome"
print('Let\'s talk about Mr. %s' %myName)
print("Let's talk about Mr. %s" %myName)
print('My height is %d inches' %myHeight)
print("My height is %d inches" %myHeight)
#Multiple Formats
print("If i add #myAge =%d & #height =%d, I'll get - %d" %(myAge,myHeight,myAge+myHeight))
print("My Eyes are : ",myEyes,"and my nose is %s" %myNose)
print('My height is perfectly %d inches tall' %(myHeight*2.54))
print(myEyes+myLips+'are sexy enough')
myHeight = 6 * meriAdaa
print(myHeight)
print(7/4)
print(round((1.499)))
# Character Play
mera_naam = "Jai Gupta"
print(mera_naam[0])
print(mera_naam[6])
# computers start counting from 0
# there is no negative zero ! Don't laugh but look at this
print(mera_naam[-1])
# therefore it prints the last character
# If you give the beginning, it will exclude the position or
# if you don't give the bginning , it will include the starting Position
# ranging with the characters
print(mera_naam[1:7])
# ranging without beginnning
print(mera_naam[:7])
# print the whole fro starting
# finding lengths
print(len(mera_naam))