Advertisement
jabela

Untitled

Apr 6th, 2024 (edited)
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. gold_count = 0
  2. silver_count = 0
  3. bronze_count = 0
  4.  
  5. while True:
  6.     event = input("Enter the event or type 'done' to finish: ")
  7.     if event.lower() == 'done':
  8.         break
  9.  
  10.     name = input("Enter the student's name: ")
  11.     medal = input("Enter the type of medal (Gold, Silver, Bronze): ")
  12.  
  13.     if medal.lower() == 'gold' or medal.lower() == 'silver' or medal.lower() == 'bronze':
  14.         # Print details immediately
  15.         print("Event: " + event + ", Student: " + name + ", Medal: " + medal.capitalize())
  16.  
  17.         # Update medal counts
  18.         if medal.lower() == 'gold':
  19.             gold_count += 1
  20.         elif medal.lower() == 'silver':
  21.             silver_count += 1
  22.         elif medal.lower() == 'bronze':
  23.             bronze_count += 1
  24.     else:
  25.         print("Invalid medal type. Please enter Gold, Silver, or Bronze.")
  26.         continue
  27.  
  28. # Output the total counts of each type of medal
  29. print("\nMedal Count:")
  30. print("Gold: " + str(gold_count))
  31. print("Silver: " + str(silver_count))
  32. print("Bronze: " + str(bronze_count))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement