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
2 Respostas
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
0
Because you use the double quotes to indicate you are using a string, you can't use spam without the double quotes.