How to print ==> variable1 : variable 2 in python plz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to print ==> variable1 : variable 2 in python plz

19th Apr 2020, 1:19 PM
Samah Mamour
4 Answers
+ 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)
19th Apr 2020, 2:37 PM
Lothar
Lothar - avatar
+ 2
There are many ways. One of the way is print(A, " : ", B)
19th Apr 2020, 1:41 PM
Peter Parker
Peter Parker - avatar
+ 2
Thank you so much guys for help 🙏
19th Apr 2020, 3:54 PM
Samah Mamour
19th Apr 2020, 2:10 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar