Feb-23-2020, 11:47 PM
Hello All,
I am trying to do four simple things:
1. Prompt user for input,
2. Store user entered input in variable,
3. Repeat 1 and 2,
4. Add the values stored in two variables and output/display the result.
I know the following works:
I am using Python3.8.1
I am trying to do four simple things:
1. Prompt user for input,
2. Store user entered input in variable,
3. Repeat 1 and 2,
4. Add the values stored in two variables and output/display the result.
I know the following works:
print("Enter the first number:", end = ' ') first = int(input()) print("Enter the second number:", end = ' ') second = int(input()) print("The answer is:", first + second)BUT I want to do it all on a single line, like below - is this even possible?
print("Enter another number:", end = ' ', third = int(input()), "And another number:", end = ' ', fourth = int(input()), "The answer is:", third + fourth)When I try the single line, I get
Quote:SyntaxError: positional argument follows keyword argumenterror message.
I am using Python3.8.1