Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. import os
  2.  
  3. x = True
  4.  
  5. players = []
  6.  
  7. height = []
  8. weight = []
  9.  
  10. heightdic = {}
  11. weightdic = {}
  12.  
  13. num = 1
  14. lh = 1
  15. lw = 1
  16.  
  17. def datain(nt):
  18.     for val in range(nt):
  19.         global lh
  20.         global lw
  21.         valh = int(input("Enter the height of the {} player in cm: ".format(lh)))
  22.         valw = int(input("Enter the weight of the {} player in kg: ".format(lw)))
  23.         lh = lh + 1
  24.         lw = lw + 1
  25.         height.append(valh)
  26.         weight.append(valw)
  27.         weightdic = dict(zip(players, weight))
  28.         heightdic = dict(zip(players, height))
  29.         print(heightdic)
  30.         print(weightdic)
  31.  
  32. def values(nt):
  33.     for key in range(nt):
  34.         global num
  35.         pnum = "p" + str(num)
  36.         num = num + 1
  37.         players.append(pnum)
  38.         datain(nt)
  39.  
  40. def main():
  41.     global x
  42.     while x == True:
  43.         try:
  44.             nt = int(input("Enter the number of teammates (min. 10): "))
  45.         except ValueError:
  46.             print("You have to enter an integer")
  47.             os.system('read -sn 1 -p "Press any key to continue..."')
  48.             print("\n")
  49.         if nt < 1:
  50.             print("Minimal number of teammates is 10 not, {}".format(nt))
  51.             os.system('read -sn 1 -p "Press any key to continue..."')
  52.             print("\n")
  53.         else:
  54.             values(nt)
  55.             x = False
  56.  
  57. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement