How to use quotation Mark's ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to use quotation Mark's ?

x = input() y = 2020 z = (int(y)-int(z)) print("your age is ", z) Here if my input is 2000 Output = your age is 20 But the output I want = your age is "20" How do I do that?

6th Aug 2020, 2:46 AM
vikas vanampally
vikas vanampally - avatar
2 Answers
+ 4
print("your age is \"20\"") Try this👆 Output: your age is "20" backslash just lets you continue the sentence and allows you to skip a " or next line It is also used like this too print("Hello \ world") If you want a variable to be inserted then: You can do it by 2 ways: print("your age is \""+str(z)+"\"") (str converts your number to a string) Or print(f"your age is \"{z}\" ") (notice the 'f' at the beginning) there are many other ways! Pls tell if you want to know
6th Aug 2020, 3:27 AM
Namit Jain
Namit Jain - avatar
+ 1
print ("your age is ", ' " ' , z , ' " ') Adjust the spaces as you require I typed it here like that as you to understand
6th Aug 2020, 2:58 AM
Abijith . U
Abijith . U - avatar