SHARE
TWEET

06. Cinema Tickets - Python

aneliabogeva Apr 18th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name = input()
  2.  
  3. total_stident = 0
  4. total_kid = 0
  5. total_standard = 0
  6. total_ticket = 0
  7.  
  8. while name != "Finish":
  9.     counter_student = 0
  10.     counter_standard = 0
  11.     counter_kid = 0
  12.     total_counter = 0
  13.     freeplaces = int(input())
  14.     type = input()
  15.     while type != "End":
  16.         if type == 'student':
  17.             counter_student += 1
  18.         elif type == 'standard':
  19.             counter_standard += 1
  20.         elif type == 'kid':
  21.             counter_kid += 1
  22.         total_counter +=1
  23.         if total_counter >= freeplaces:
  24.             break
  25.         else:
  26.             type = input()
  27.     capacity = (total_counter / freeplaces) * 100
  28.     print(f"{name} - {capacity:.2f}% full.")
  29.     total_kid += counter_kid
  30.     total_standard += counter_standard
  31.     total_stident += counter_student
  32.     total_ticket = total_standard + total_stident + total_kid
  33.     name = input()
  34. print(f"Total tickets: {total_ticket}")
  35. print(f"{((total_stident /total_ticket)*100):.2f}% student tickets.")
  36. print(f"{((total_standard /total_ticket)*100):.2f}% standard tickets.")
  37. print(f"{((total_kid /total_ticket)*100):.2f}% kids tickets.")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top