0

Python code not validating number

1==1 returned false #you input something that ends in 11111 z=input() print(z[-1],'cnp') v=1 print(v,'rest') if z[-1] == v: print('yes') else: print('nono')

10th Feb 2022, 6:53 PM
Ticoan Ionut
Ticoan Ionut - avatar
2 Answers
0
z[-1] is character v is a number so it teturn false try if int( z[-1]) == v : else take v = '1'
10th Feb 2022, 6:57 PM
Jayakrishna šŸ‡®šŸ‡³
0
Solved it just now i did b=z[-1] if int(b)==v: print ('yyy') else: print('nnn') I needed it to be int
10th Feb 2022, 7:00 PM
Ticoan Ionut
Ticoan Ionut - avatar