first of all:
second:
so what you really want is (i changed function name to lower case, camel case should not be used for function names (PEP 8):
example:
def enterNumbers(): float(input("Type numbers: ")) returnreturns None, because you didn't tell it to return anything.
second:
float(input("Type numbers: "))will fail, not written properly
so what you really want is (i changed function name to lower case, camel case should not be used for function names (PEP 8):
def enter_numbers(): nums = input("Type numbers: ") nums = [float(item) for item in nums.split()] return numsBut now, nums will be a list of numbers (maybe only 1 element), but each will be a float
example:
Output:enter_numbers()
Type numbers: 1 2 3 4
print(numbers)
[1.0, 2.0, 3.0, 4.0]
so code for enter_numbers needs to look like:# Enter numbers and store them as "enterNumbers()" module? def enterNumbers(): nums = input("Type numbers: ") nums = [float(item) for item in nums.split()] return numsAnd the other functions need to use this format:
# Enter numbers and store them as "enterNumbers()" module? def enterNumbers(): nums = input("Type numbers: ") nums = [float(item) for item in nums.split()] return nums # This "calculate" module calls the "enterNumbers()" module, adds 1, and returns "a" which basically means "a" in the module IS "calculate()?" def calculate(): a = [item + 1.0 for item in enterNumbers()] return a # This "main()" module calls both module to calculate? def main(): numbers = calculate() print(numbers) if __name__ in '__main__': main()if run:
Output:Type numbers: 1 2 3 4 5
[2.0, 3.0, 4.0, 5.0, 6.0]