Aug-30-2021, 05:25 AM
For some reason I get an error trying to multiply two numbers after returning each value through its respected function.
Here is my error message:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
def get_user_input_1(): user_input = input ( 'Type a number: ' ) return user_input def get_user_input_2(): user_input = input ( 'Type another number to multiply by your first number: ' ) return user_input def calculate_result(x, y): if x or y ! = 'q' : x = int (x) y = int (y) result = x * y print (result) get_user_input_1() get_user_input_2() calculate_result(get_user_input_1, get_user_input_2) |
Error:Traceback (most recent call last):
File "C:\Users\Vadim\Desktop\Anti Clog Folder\Coding Stuff\Python\Project1\test.py", line 21, in <module>
calculate_result(get_user_input_1, get_user_input_2)
File "C:\Users\Vadim\Desktop\Anti Clog Folder\Coding Stuff\Python\Project1\test.py", line 13, in calculate_result
x = int(x)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'function'
Process finished with exit code 1
I also get this as a highlighted warning in PyCharm referring to the first argument in "calculate_result".Error:Expected type '{__mul__}', got '() -> str' instead