ValueError: invalid literal for int() with base 10: '' | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

ValueError: invalid literal for int() with base 10: ''

I got this message after my first print: from random import * budget = 200 print("ciao hai " + str (budget) + " Euro a disp") if budget>0: while budget>0: num_scelto= int (input("\ninserisci un numero tra 0 e 49 ")) print("\nprocediamo all'estrazione....") if num_scelto < 0 or num_scelto >50: print("scegli tra 0 e 49") #Error in digitation else: print("\n hai scelto il numero ... "+ str(num_scelto)) puntata= int(input("\nscegli una somma:")) if budget- puntata < 0: puntata = int(input("ripetere la puntata:")) else: print("\n ti rimangono" + str(budget - puntata) + "euro..." ) print ("\nhai puntato" + str(puntata) + "euro") estratto = (randint(0,49)) print( "\nil numero estratto è " + str(estratto)) if estratto != num_scelto: budget= budget - puntata print("\nhai perso ora hai " + str(budget)) else: vincita = puntata *50 budget = budget + vincita print("hai indovinato ora hai " + str(budget)) else: print(budget) print("fine")

29th May 2020, 2:40 PM
Daniele Baldoni
Daniele Baldoni - avatar
5 Réponses
+ 4
What are the inputs and outputs for program?
29th May 2020, 2:50 PM
Abhay
Abhay - avatar
+ 2
Paste your code in playground and then give firstly it is small and it has no bold or italic characters it will be not easy to find errors even its not good for reading
6th Dec 2020, 6:18 PM
Sayyam Jain
Sayyam Jain - avatar
+ 1
Sorry I don't understand what you mean by sum Can you give an example of inputs ? like 23 38 45 And like that ,so I can run it and see where error is occurring or can you tell Exactly at which line you are getting error invalid literal for int()?
30th May 2020, 9:11 AM
Abhay
Abhay - avatar
0
The input should be a number from 0 to 49 and specify a sum to bet. You have to guess a number than python will return a random int number. If you guess it you will add points otherwise you will loss
30th May 2020, 8:57 AM
Daniele Baldoni
Daniele Baldoni - avatar
0
OK error In line 19. Invalid literal for int() with base 10. I would choose a number between 0 and 49. Then computer extract another one with Randint. If you guess the number you win... Like in casino
30th May 2020, 4:11 PM
Daniele Baldoni
Daniele Baldoni - avatar