+ 2

What's wrong in this?

Well.... This code is a cricket game in which user gives the run and if that run is guesses by computer he gets out! But in this program computer is not displaying the part of out![see program] https://code.sololearn.com/cCcd8R0IR0G4/?ref=app

8th Jun 2020, 9:10 AM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar
2 Respuestas
+ 2
run will never equal x. run is a string and x is an integer. You have to switch the type
8th Jun 2020, 9:23 AM
Slick
Slick - avatar
+ 7
You have to change this: com=[1,2,3,4,5,6] x=com[rand.randint(0,7)] # to -> x=com[rand.randint(0,5)] , as com has a len of 6 elements that means index can be max 5.
8th Jun 2020, 10:06 AM
Lothar
Lothar - avatar