+ 1

Guys why is it showing None and not showing me the largest one digit number, tell me what did i did was wrong

https://code.sololearn.com/c6jMWperr2qi/?ref=app

21st Jan 2022, 6:46 AM
zeeshan
zeeshan - avatar
2 Respostas
+ 2
When you call your function number(131,325) x = 3 and y = 3 since both parameters are of length 3 when cast into string. So range(int(x),int(y)) Is evaluated to be range(3,3) There is nothing in that range so the for loop was not ran and therefore nothing was printed causing your result of None.
21st Jan 2022, 7:12 AM
Sandy Ho
Sandy Ho - avatar
+ 1
I wrote the code doing what you want to do. There are casting issues in your code since you cannot reference an int with index and compare a string like integers. Do note that you are missing the case when num1 and num2 have the same largest digit, I just make it return num1. https://code.sololearn.com/cKpng3d842L2/?ref=app
21st Jan 2022, 7:35 AM
Sandy Ho
Sandy Ho - avatar