-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex6_Strings.py
16 lines (14 loc) · 950 Bytes
/
ex6_Strings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
x = "There are %d types of people." % 10 #here we define a variable x which holds a string and we are inserting 10 in bet the string
binary = "binary" #here we declared and initialized the varibale biinary with value equals binary
do_not = "don't" #here we decalared and initialized another variable do_not
y = "Those who know %s and those who %s." % (binary, do_not)#here we are inserting two variable inside a string
print x #printing var x
print y #printing var y
print "I said: %r." % x #inserting a string in a string
print "I also said: '%s'." % y #inserting string in a string
hilarious = False #declaring and initializing the variable
joke_evaluation = "Isn't that joke so funny?! %r" #initializing the variable
print joke_evaluation % hilarious #printing two var holding strings using % operator
w = "This is the left side of..." #def a var
e = "a string with a right side." #def a var
print w + e #concatenating and printing two strings