+ 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?
2 Antworten
+ 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
+ 1
print ("your age is ", ' " ' , z , ' " ')
Adjust the spaces as you require I typed it here like that as you to understand