Python Score Counter For Controlled Test -
Python Score Counter For Controlled Test -
i have controlled assessment in 7 hours requires me build programme can maintain score of competition. in competition there 4 teams , 5 games. need programme give 1 point teams in event of tie, 2 points home win , 3 points away win. need display error message or when wrong team number has been entered. can help? needs in python.
i've been coding few weeks , have no thought i'm doing. trying figure out how print out statement when wrong team number entered without counting within loop
my code far:
schoolnumber = [1,2,3,4] homescores =[0,0,0,0] awayscores=[0,0,0,0] counter in range(0, 5): whohost = int(input("who hosted game? ")) whowins = int(input("who winner? ")) if whohost == whowins: homescores[whowins-1] += 2 else: awayscores[whowins-1] += 3 print(homescores) print(awayscores)
for counter in range(0, 5): while true: try: whohost = int(input("who hosted game? ")) whowins = int(input("who winner? ")) if whohost in schoolnumber , whowins in schoolnumber: break else: raise valueerror() except valueerror: print('please come in valid number list {}'.format(schoolnumber)) if whohost == whowins: homescores[whowins-1] += 2 else: awayscores[whowins-1] += 3
this loop on 2 input
statements until both numbers entered in schoolnumber
. if number not in list or string entered display error message , start over.
python
Comments
Post a Comment