Tuesday, February 25, 2020

format in python print statement output

a=5678.1023
b=54578.1023
print("this is monthly salary:",format(a,'>15,.2f'))
print("this is monthly expenses:",format(a,'>13,.2f'))
print("this is monthly saving:",format(a,'>15,.2f'))
print("this is monthly total:",format(a,'>16,.2f'))

output:


example 2:
a=5678.1023 b=54578.1023 print("this is monthly salary:",format(a,'>15,.2f')) print("this is monthly expenses:",format(a,'>13,.3f')) print("this is monthly saving:",format(a,'>15,.4f')) print("this is monthly total:",format(a,'>16,.5f'))

output:


Print output in python language

s="anil"
a=5

print("This is {}".format(s))
print("this is %s"%s)
print('"anil" is thurum\n',end="")
print('"anil" is Thopu')
print("'anil' is daily labour")
b=print(5*4)
print(b)

output:
This is anil
this is anil
"anil" is thurum
"anil" is Thopu
'anil' is daily labour
20
None

python class topic video