0

When we use double quotes in python???

for e.g. words = ["spam","egg","spam"] print("spam" in words) then how do we know that in print statement we use double quotes can we directly use spam in print statement

11th Jun 2017, 2:27 PM
Aman Agrawal
Aman Agrawal - avatar
2 Answers
0
print(words[0]) you print the index from the list. List index starts at 0. so to print spam, you would print(words[0]) .. or print(words[2]) as your list has spam at 2 different index locations. Unless I misunderstood your question. words = ["spam","egg","spam"] print('spam' in words) if your print statement is simply to return true if spam is in the list, then single or double quotes will both return true. In Python they both signify a string
11th Jun 2017, 2:51 PM
LordHill
LordHill - avatar
0
Because you use the double quotes to indicate you are using a string, you can't use spam without the double quotes.
11th Jun 2017, 2:52 PM
Diego Moll
Diego Moll - avatar