strings and ints consistency - isinstance

Sayth Renshaw flebber.crue at gmail.com
Wed Sep 21 23:41:32 EDT 2016


This ends being the code I can use to get it to work, seems clear and pythonic, open to opinion on that :-)


answer = input("\t >> ")
if isinstance(int(answer), int) is True:
    raise ValueError("Ints aren't valid input")
    sys.exit()
elif isinstance(answer, str) is True:
        print(v0 * t - 0.5 * g * t ** 2)
else:
    print("Ok please ammend your entries")

Cheers

Sayth



More information about the Python-list mailing list