![]() |
Help for newbie with if/else statement that has or statement - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Help for newbie with if/else statement that has or statement (/thread-18191.html) |
Help for newbie with if/else statement that has or statement - Shevach - May-08-2019 Hello there, I'm trying make a simple code (to practice for loops and if/elif statements) to give a person 3 choices of what kind of book he is looking for. He can do this three times (attempt). My problem is that no matter what I enter 1.,2. or 3 it returns "you picked Non fiction. Can someone please tell me what I'm doing wrong? (after trying to figure out myself the problem for about a half an hour it is quite aggravating) Thank you very much Shevach for attempt in range (3): print('What kind of book are you looking for?') print('1. Non fiction') print('2. Fiction') print('3. Text book') type=input() if type=='1'or 'Non fiction': print('You picked Non fiction') elif type=='2'or'Fiction': print('you picked Fiction') elif type== '3' or 'Text book': print('you picked Text book') else: print('Try again') RE: Help for newbie with if/else statement - Yoriz - May-08-2019 Please see the forum thread Multiple expressions with or keyword RE: Help for newbie with if/else statement - Shevach - May-08-2019 Yoriz I can't thank you enough. (You saved my sanity.) That post you sent me is excactly what I wanted. |