Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
Input Validation
Iām trying to write a block of code that will only accept floats, integers, and the letter ādā. For some reason, the structure I have isnāt working. Am I going about this the wrong way? Any help would be greatly appreciated. https://code.sololearn.com/c4SHeEEFvLpG/?ref=app
2 Respostas
+ 3
Hi, try it changing it to this:
while True:
m = input('Please enter a measurement: ')
try:
data.append(float(m))
It seems to work.
+ 1
It works! Thank you!