Jan-27-2020, 05:52 PM
(Jan-27-2020, 08:19 AM)perfringo Wrote: All functions which don't return (or yield) anything return None.
Sorry, my bad. Got it now. You aren't returning
n
. The function just ends, making it "fruitless". while True: def absoluteValue(n): if n < 0: return -n elif n > 0: return else: print("Please key in a value greater or lower than 0 !! ") return n """<------ Fixes it""" def main(): y = input("Key in an integer : ") n = int(y) print("The Absolute Value of", y, " is ", absoluteValue(n)) main()