In my code they're instructed to enter a width and height. However obviously these will be intergers, but I need to perform checks that they are intergers before they're used.
Atm I've got this:
while True: if width.isdigit() == True and height.isdigit() == True: if width >= 2 and width <= 8: if height >= 2 and height <= 8: break else: width, height = eval(input("Enter the width and height of patches: (e.g. 6, 3) ")) else: width, height = eval(input("Enter the width and height of patches: (e.g. 6, 3) ")) else: print("You have entered word(s) rather than numbers")
I remember reading in the Zelle book but can't find it about being able to "eval(width" or "eval(height)" or something after it's been in putted? Is this true?
Because I was thinking of using width, height = input("Enter the blah blah... ") rather than using eval. And then possibly I could perform the ".isdigit()" or ".isalpha()" function on it to check. Can someone shed some light please?