-
Notifications
You must be signed in to change notification settings - Fork 0
/
StringFormat.py
28 lines (22 loc) · 1.12 KB
/
StringFormat.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
#animal = "cat"
#item = "moon"
#print("The "+ str(animal) +" jump over the "+ str(item))
#print("The {} jump over the {}".format(animal,item))
#print("The {1} jump over the {0}".format(animal,item)) #Positional argument
#print("The {animal} jump over the {item}".format(animal="fox",item="sun")) #Keyword argument
#text = "The {} jump over the {}"
#print(text.format(animal,item))
nama = "vier"
print("Hello my name is {}".format(nama))
print("Hello my name is {:9} Nice to meet you".format(nama))
print("Hello my name is {:<9} nice to meet you!".format(nama))
print("Hello my name is {:>9} nice to meet you!".format(nama))
print("Hello my name is {:^9} nice to meet you!".format(nama))
#number = 1000
#print("The number of pi is {:}".format(pi))
#print("The number of pi is {:.2f}".format(pi))
#print("The number is {:,}".format(number))
#print("The number is {:b}".format(number)) #Binary of your number
#print("The number is {:o}".format(number))
#print("The number is {:x}".format(number)) #Hexadecimal of your number
#print("The number is {:e}".format(number)) #scientific of your number