Jan-02-2020, 11:41 PM
That looks like the right direction, but note that you are double using n as a parameter to in_range and as a for loop variable on line 36. I would really suggest learning to use return values. Here's how I would have done it:
def in_range(n, num_range): return num_range['start'] <= number <= num_range['end'] def find_range(n): for num_range in _number_ranges: if in_range(n): break return num_range def check_range(): userinput = input("Enter the Number Yo") num_range = find_range(int(userinput)) print('{} is a {} number'.format(userinput, num_range['name']
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures