-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathex5.py
56 lines (43 loc) · 1.22 KB
/
ex5.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
# formattted String
# "" around something is a format string
# Embedding variables inside a String
#format sequence
myName = 'Jai Gupta'
myAge = 22 # not a lie
myHeight = 74 # inches
myWeight = 160 #lbs
myEyes = 'Blue'
myTeeth = 'White'
myHair = 'Brown'
# formatter
first_name = "Jai"
last_name = "Gupta"
print("Dummy Run")
print("The name is", first_name, last_name)
print("Bhai ka naam hai : %s %s aur bhai ki age hai : %d" %(first_name, last_name, myAge))
new_name = 'anu'
print('Mere ko %d print karna hai %d times')
# %s > string
# %d > integer
# %f > float
print ("Let's talk about %s !" % myName)
print ("He's %d inches tall !" % myHeight)
print ("He's %d pounds Heavy!" % myWeight)
# Multiple formats
# TODO: To check how to print %d
print("If I add %d, %d, and %d, I get %d." %(myAge, myHeight, myWeight, myWeight+myAge+myHeight))
print("He's %d inches tall !" % (myHeight*2.54))
print(" How to print this %d even after using it")
print("")
print ('Dummy Inside')
print (myTeeth + myHair)
# anyVariable = "LOL"*10.54 # unexpected indent
lol = "LOL"*10
print (lol)
# # More Strings ***
# concatenating string
meraNaam = 'Jai'
meraNaam_last = 'Gupta'
print(meraNaam + meraNaam_last)
print(meraNaam, meraNaam_last)
# stackoverflow