-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring formatting.py
More file actions
25 lines (23 loc) · 1 KB
/
string formatting.py
File metadata and controls
25 lines (23 loc) · 1 KB
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
name = "AREEB SIDDIQUI"
message= "Hello"
M2=input("Please enter your name: ")
print("{},{} the person written name on your terminal is {}".format(message,name,M2))
#string formating example for python 2.7
name = "AREEB SIDDIQUI (3.6)"
print(f"{message},{name} the person written his name on your terminal is {M2}")
#string formating example for python 3.6
#INDEXING OF STRING
ALIVE='AREEB SIDDIQUI'
#ALIVE[0]='A' ALIVE[1]='R' ALIVE[2]='E' ALIVE[3]='E' ALIVE[4]='B' ALIVE[5]=' ' ALIVE[6]='S' ALIVE[7]='I' ALIVE[8]='D' ALIVE[9]='D' ALIVE[10]='I' ALIVE[11]='Q' ALIVE[12]='U' ALIVE[13]='I'
#ALIVE[-1]='I' ALIVE[-2]='U' ALIVE[-3]='Q' ALIVE[-4]='I' ALIVE[-5]='D' ALIVE[-6]='D' ALIVE[-7]='I' ALIVE[-8]='S' ALIVE[-9]=' ' ALIVE[-10]='B' ALIVE[-11]='E' ALIVE[-12]='E' ALIVE[-13]='R' ALIVE[-14]='A'
#PRINT(ALIVE[START:END:SKIP])
print(ALIVE[0]) #A
#EXAMPLE
for i in range(0,len(ALIVE)):
print(ALIVE[i],end=' ')
break
#EXAMPLE FOR CONCATINATION
NAME='AREEB'
NAME1='SIDDIQUI'
NAME2=NAME +NAME1
print(NAME2)