Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #The question is "Write code that prints Hello if 1 is stored in spam, prints Howdy if 2 is stored in spam, and prints Greetings! if anything else is stored in spam"
  2.  
  3. #My problem is the program ends after returning a response to the user input
  4.  
  5. #How do I make it restart by asking the question in a loop?
  6.  
  7. print ('What is the value of spam')
  8. spam = int(input())
  9. if spam == 1:
  10. print ('Hello')
  11.  
  12. elif spam == 2:
  13. print ('Howdy')
  14.  
  15. else:
  16.  
  17. print ('Greetings!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement