I do bot know what did I do incorrect

score = 0
print("Hello user")
print("do you want to answer my riddles")
print("of course yes)")
while input("What can be touched but can't be seen?") !=heart:
print ("wrong")
print("well done") and score = score + 1
print(score)

+1 vote
answered Sep 30, 2021 by (4,920 points)
Thanks for sharing snippet of code in question.
It would be more helpful if you share details about what you wanted to achieve with this code and where exactly you get stuck. It would be helpful for the fellow users to understand problem and help you.
+1 vote
answered Sep 30, 2021 by (45,180 points)

Legend

• red: content removed

score = 0
print("Hello user")
print("do you want to answer my riddles")
print("of course yes)")
while input("What can be touched but can't be seen?") != "heart":
print("wrong")
print("well done") and[ENTER]
score = score + 1
print(score)
+1 vote
answered Dec 6, 2021 by (170 points)

There are a couple of things wrong. First, when checking if input is heart, you want heart in quotes since it is a string.

It goes from this:

while input("What can be touched but can't be seen?") != heart:

to this:

while input("What can be touched but can't be seen?") != "heart":

It is a small change, but it turns heart from a variable to a string.

Secondly, you can't do "print and". You would use and like this:

if x == 0 and y == 1:

The like would go into two separate lines, like this:

print("well done")
score = score + 1

The fixed code looks like this:

score = 0
print("Hello user")
print("do you want to answer my riddles")
print("of course yes")
while input("What can be touched but can't be seen?\n") != "heart":
print ("wrong")
print("well done")
score = score + 1
print(score)

Also, you want \n at the end of the input so the next print goes on a different line ("\n" is the way to insert a newline).