mercredi 17 mai 2023

can you help me correct the program which generates random dice rolls

def reject():
  print("get out!")
  quit()
import random
print("chooses random dice rolls")
maximumval=int(input("how many dice rolls do you want?"))
if maximumval<0:
   reject()
else:
    counter=1
    while counter<=maximumval:
        counter=str(counter)
        mydict={
      
         }
         
         val=random.randint(1,7)
         val=str(val)
         mydict.update({counter:val})
         val=int(val)
         counter=int(counter)
        counter+=1
    print(mydict)

it gives parseError on line 17

I was not able to solve it please help me it says parseError. Please help me fix my code please!




Aucun commentaire:

Enregistrer un commentaire