+ 1
How to print ==> variable1 : variable 2 in python plz
4 odpowiedzi
+ 3
You can use f-string, which is a very convenient and up-to-date way of outputting content. It also allows you to create strings.
length = 14
width = 6
print(f'{length} : {width}') # output is now "14 : 6"
out = f'{length} : {width}'
# out is now "14 : 6"
out = f'{length} / {width} = {length / width:.2f}'
# out is now 14 / 6 = 2.33
print(out)
+ 2
There are many ways. One of the way is print(A, " : ", B)
+ 2
Thank you so much guys for help 🙏