0
Help me , I don't understand this exercise!
Why this code fail in Argentina practice code? Somebody can help me? values = list(input()) num1 = int(values[0]) num2 = int(values[1]) peso_to_dolar = num1 * 2 / 100 dolar = num2 if peso_to_dolar < dolar : print("Pesos") else: print("Dollars")
7 ответов
+ 1
Instead using type conversion in input use 2 different input functions, one for dollar and one for pesos.
Then do pesos to dollars conversion. Then whole code is same.......
Hope it helped
0
The problem is on the first 3 lines of code. If you enter a single number like 15 there will be no problem (This number is actually treated as a string, and it's digits will act in the programme as two numbers), but you cannot expect to get numbers with more than one digit to operate with. Also, if the User enters something like (1, 17.45, 35.0) the programme could not convert he was 2nd element into an integer, 'cause that element would be a string *Remember that the interpreter takes any input as a string*, and there would be a ValueError. The int function cannot either convert other punctuations or spaces. So, the whole thing depends on what the User enters. I hope this explanation's helped you, guy.
0
When I wrote "he was" I meant "the", sorry
0
I totally agree with Sanjyot 🖒
0
Thank you guys
0
print ('You're welcome')
0
print("Thank You My friend")