dimanche 10 février 2019

Why am I receiving "incorrect" output in this ifelse statement?

I am new to python and trying to learn by doing small projects.

I am trying to write a program that displays the names of the four properties and asks the user to identify the property that is not a railroad. The user should be informed if the selection is correct or not.

properties = "Reading,","Pennsylvania","B & O","Short Line"
question = str(input("Which is not a railroad?")) **Short Line**
if properties == "Short Line":
    print("correct")
else:
    print("incorrect")

However, my final output shows as "incorrect", what am i doing wrong?

The four railroad properties are Reading, Pennsylvania, B & O, and Short Line. Which is not a railroad? Short Line Correct. Short Line is a bus company.

Aucun commentaire:

Enregistrer un commentaire