Section 4.1, step 15


#1

How do I get the program to print out the actual numbers that are chosen for the formula? This is how I have it coded.

Type your code below this line

Number1 = int(input(“Number1”))
Number2 = int(input(“Number2”))
print(“Number1 + Number2 =”, Number1 + Number2)
RESULTS
Number1 5
Number2 10
Number1 + Number2 = 15

Any help is greatly appreciated!

Celeste Graham


#2

Looks like you have the right idea for your syntax for printing the formula. Why not apply the same syntax to the number variables?


#3

What am I doing wrong?


#4

I believe they are looking for variables and syntax, not actual numbers. So that the code can apply to any set of numbers.


#5

It strikes me that you are responding to the prompts rather than entering the needed syntax so as to produce a workable block of code.

For example, on the first line, the prompt statement includes the text, “Enter the first number:”, and it looks like that’s what you’ve done by entering the string “5” in the editable field.

What they are asking you to do is add the correct syntax in that field so that the code could actually execute.

That first line is assigning the value of the input statement to the variable “number1”, and it tells you that it is casting that value to an int (remember, all input data starts off as a string). What syntax would you need to include in that prompt statement to accomplish that? In other words, what Python keyword needs to go there to make it work?

Once you get that straightened out, use the same thought process for the rest of the lines. Remember, they’re looking for syntax, not your response to their prompt text!


#7

Hello, I am here and I entered the code below but nothing is showing up. I checked it in the repl thing and it works there, but isn’t working here. Also, when I try to fill in the blanks on the next question, it keeps telling me that I am incorrect. Can someone help me with this please?

admin: edited to remove large code block

print(“the total is:”, total_sum)


#8

hey did you find the answer


#9

I believe you already solved this, @gcanchola, but if we ask you to write a print statement throughout Discovery, we only ever want you to print the value. It’s not possible on Stepik for us to automatically grade any number of formatting decisions that folks can make regarding their printed output. In this case, you’d just want to print the value of the sum you calculated.