+ 2
How do I write my age is n years,n is a variable having a value. I am getting errors
5 Answers
+ 3
a = 12
b = 30
print("The answer of {} + {} is {}, as anything".format(a,b,a+b))
+ 2
n = 25
print("My age is {} years!".format(n))
+ 2
You can use same syntax. You will need to specify order of the variables in format() statement. For example :
name = 'John'
age = 25
print("Hello. My name is {} and I am {} years old".format(name,age))
+ 1
Thank you
How can I write if I should use two variables in same print statement?
0
Please explain for both na. ...I jst started learning python and would like to learn more and more