SHARE
TWEET

Untitled

a guest Jul 19th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. check_table = [(1,'Classic', 'Cheddar', 'Medium'), (2,'Big', 'Cheddar', 'Rare'), (3,'Classic', 'Cheddar', 'Rare')]
  2.  
  3. # Variables
  4. steaks = 0
  5. rare = 0
  6. medium = 0
  7. w_done = 0
  8.  
  9. # Getting all the data from a nested for
  10. for x in range(len(check_table)):
  11.     for y in range(len(check_table[0])):
  12.         # Getting the number of steaks
  13.         if check_table[x][y] == "Classic":
  14.             steaks += 1
  15.             # Getting the style of the steak
  16.             if check_table[x][y] == "Rare":
  17.                 rare += 1
  18.             elif check_table[x][y] == 'Medium':
  19.                 medium += 1
  20.             elif check_table[x][y] == 'Well-done':
  21.                 w_done += 1
  22.  
  23.         elif check_table[x][y] == "Big":
  24.             steaks += 2
  25.             # Getting steak style
  26.             if check_table[x][y] == 'Rare':
  27.                 rare += 2
  28.             elif check_table[x][y] == 'Medium':
  29.                 medium += 2
  30.             elif check_table[x][y] == 'Well-done':
  31.                 w_done += 2
  32.  
  33. print("# Steaks ", steaks)
  34. print("# Rare ", rare)
  35. print("# Medium ", medium )
  36. print("# Well-done ", w_done)
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