0

How to print a string and integer by the same print("") function without concatenating them???

26th Dec 2017, 7:09 AM
Ankit Pal
Ankit Pal - avatar
3 Antworten
+ 2
Here are a couple of ways: 1. Seperate values by a comma print(str, int) 2. Use string formating print("Hi my name is {0}, I am {1}".format(name, age)) edit: 3. You could also just do print("the answer is" + str(c))
26th Dec 2017, 7:19 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
thanks
26th Dec 2017, 7:50 AM
Ankit Pal
Ankit Pal - avatar
0
I want to print like this eg. c=10 #print("the answer is" + c) such that the output shows like the answer is 10
26th Dec 2017, 7:18 AM
Ankit Pal
Ankit Pal - avatar