mardi 25 août 2015

Python - Using words from text file for if/then statement

I was wondering how to use words from a text file for an if/then statement in Python. For example, if I had a text file of different fruits (apple, orange, banana, strawberry), how would I get Python to print "Fruit" if a user input is a fruit in the text file and print "Not Fruit" if a user input is not a fruit in the text file?

Aucun commentaire:

Enregistrer un commentaire