Can someone tell me if I did this right (TL3 note: possible school assignment)

``````# Given number1=8 and number2=13 write a program to only displays if the sum is less than 10.

num1 = int(input("Enter your number "))
num2 = int(input("Enter your number "))
sum = "num1 + num2 == 10"
if num1 + num2 > 10:
print("This is greater than 10")
else:
print("This is less than 10")
``````

I donâ€™t understand why you have this string here.

So I donâ€™t need to have that to add them together?

https://replit.com/@doxr/JumboSturdyHypothesis

I donâ€™t know much Python but I got some errors.

``````num1 = int(input("Enter your number "))
num2 = int(input("Enter your number "))
# sum = num1 + num2 == 10 Removed this
if num1 + num2 > 10:
print("This is greater than 10")
else:
print("This is less than 10")
``````

is my fixed version. I removed what @CoderElijah said.

doesnâ€™t seem to work, I donâ€™t really know why. I used " instead

1 Like

uhh looks like

`if num1 + num2` does the job. Also, you made `sum` but you never really used itâ€¦

Ok, thank you so much you are awesome.

That canâ€™t add them together. That is a string and as such is just text with no calculations. Also `==` is used for comparison, not assigning a variable.

2 Likes

Looks like a school assignment. Next time donâ€™t just give the answer.

2 Likes

They did all the work and asked if it works. I donâ€™t know much python but the errors told me what to fix on Replit. I didnâ€™t code it, they did. After that, I donâ€™t think there is a problem but thatâ€™s just my opinion.

Besides, I donâ€™t know the answer (lol i donâ€™t code in python)

I honestly entirely disagree. You should let the student debug on their own.

2 Likes

Thank you all, Iâ€™m new to python and I appreciate the help. ; )

1 Like