No Description

mountain_poll.py 731B

1234567891011121314151617181920212223
  1. responses = {}
  2. # Set a flag to indicate that polling is active.
  3. polling_active = True
  4. while polling_active:
  5. # Prompt for the person's name and response.
  6. name = input("\nWhat is your name? ")
  7. response = input("Which mountain would you like to climb someday? ")
  8. # Store the response in the dictionary:
  9. responses[name] = response
  10. # Find out if anyone else is going to take the poll.
  11. repeat = input("Would you like to let another person respond? (yes/ no) ")
  12. if repeat == 'no':
  13. polling_active = False
  14. # Polling is complete. Show the results.
  15. print("\n--- Poll Results ---")
  16. for name, response in responses.items():
  17. print(name + " would like to climb " + response + ".")