samedi 1 novembre 2014

(Beginners Python) Creating if/else statements dependent on user input?


Vote count:

0




I'm new to Python (And programming in general) so this may be a rather simple issue to resolve.


I'm trying to create a simple script that will will ask a question to which the user will input an answer (Or a prompt with selectable answers could appear?), and the program would output a response based on the input.


For example, if I were to say


prompt1=input('Can I make this stupid thing work?')


I would have something along the lines of


if prompt1='yes':



print('Hooray, I can!')


else prompt1='No':



print('Well I did anyway!')


elif prompt1=#an answer that wouldn't be yes or no



#repeat prompt1


I'm probably going about this the wrong way. Please be as descriptive as possible as this is a learning exercise for me. Thanks in advance!



asked 1 min ago







(Beginners Python) Creating if/else statements dependent on user input?

Aucun commentaire:

Enregistrer un commentaire