#๐Ÿ”’ explain this error

27 messages ยท Page 1 of 1 (latest)

left summit
#

so it has asked me to write a program which asks the user for two numbers. The program will then print out the sum and the product of the two numbers.

The program should function as follows:

Number 1: 3
Number 2: 7
The sum of the numbers: 10
The product of the numbers: 21

and then i wrote the code as

number2 = int(input("Number 2:"))
addition = (number1 + number2)
product = (number1 * number2)


print(f"The sum of the numbers:{addition}")
print(F"The product of the numbers:{product}") ```

i got the result correctly and exactly but it is showing this error
queen vigilBOT
#

@left summit

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

#

Hey @left summit!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
ancient sand
#

it works for me.
could you maybe show a screenshot of the code in your ide

left summit
#

just a second

eager oak
#

Probably formatting that the tester is checking and failing.

#

ie should there be a space between the colon and the product or sum, etc

ancient sand
left summit
ancient sand
eager oak
#

That error is from trying to put a non-input (ie just pressed enter) into a number.

left summit
#

my bad

#

so this is what i got now

#

it is still saying the same

ancient sand
#

yeah can you show a screenshot of your code

left summit
left summit
analog ruin
#

You need a space between : and the number.

#

The sum of the numbers:(space here)10

left summit
#

not working still

left summit
#

thanks mate

#

What was the problem tho

analog ruin
#

It was looking for it to be formatted a certain way.

queen vigilBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.