0
Please help me understand this.
text 5="I love programming" text 6="I love science" text 7="I love myself" text =[text5, text6, text7] new=text [1][3] print (h+new+t+p+y)
3 Respuestas
+ 1
Like this it works (removed spaces and added quotes):
text5="I love programming"
text6="I love science"
text7="I love myself"
text =[text5, text6, text7]
new=text [1][3]
print ("h"+new+"t"+"p"+"y")
It adds the letters h o t p and y into a single string. The o comes from text6, it is the fourth character.
Variable new takes the second word out of the list (That is index 1) and the fourth character out of the word (That is index 3).
+ 1
#FIXED
text 5="I love programming"
text 6="I love science"
text 7="I love myself"
text =[text5, text6, text7]
new=text [1][3]
#new = text6[3]
#new = "o"
print ("h"+new+"t"+"p"+"y")
#it prints: h+o+t+p+y: "hotpy"
0
Wrong variable name
*spaces aren't allowed as part of variable names