python - New to programming and trying to finish this task for school, I can't seem to add numbers in a list together -


i have bit of code thats task have complete school. i'm trying add numbers in list can average number. whenever try tells me unsupported operand type int , str. think have convert inputs floats rather strings i'm not sure how to. code below:

final = false while final == false:      judgescoreforloop = 0     judgescoreloop = []      while true:         try:             eventname = str(input("what event's name? "))             numberjudges = int(input("how many judges there? "))             competitorname = str(input("what competitor's name? "))             judgescoreforloop in range (0, numberjudges):                 judgescore = input("enter judge score here: ")                 judgescoreloop.append(judgescore)                 judgescoreforloop + 1             break         except valueerror:             print("one of inputs invalid, please try again.")      finaljudges = numberjudges - 2      judgescorecombined = sum(judgescoreloop)     judgefinalscore = judgescorecombined / finaljudges      if competitorname == "finish".lower():         final = true      print(judgefinalscore) 

you can convert input straight float

  judgescore = float(input("enter judge score here: ")) 

but might best check if user has supplied number first prehaps using isdigit() don't want give away should help


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -