Raspberry Pi / Computer projects

Using try in Python

a=0
while a<1:
    try:
        a=a+1
        number=int(raw_input("What is the number?"))
    except:
        print "Error!Please enter a number!"
        a=a-1

Published 11/03/2015 · Krunk Zhou

Join the conversation