0

I keep getting the error code : input of 1 yields output of 9000000000000 expected........

this is the code i wrote

Defining the main

def main(): m = int(input("How many kg's are squared with E+mc2? ")) e = m 300000000 + 300000000 print(e)

return main

main()

What have I done wrong or where can I improve this code? I don't want to just copy and paste someone else solution, I want to understand what's actually happening and why.

Should I have given m and created j and given them values? i also feel I am adding 300000000 together for no reason as i could just write 600000000? Is this creating an extra step that isn't needed?

I will keep trying to problem solved myself and if I figure it out I will update.

Thank you for your comments in advance. Paul.

So I changed the value of e, now the check is saying number 1 output is correct, but the rest are not? How can number 1 check be correct but the others wrong? screen shot attached.screenshot of issue

1 Answer 1

1

I was making a define when I didn't need to at all, over complicating my code and trying to run before I can walk, I rewatched the lecture and stripped back down to basics.

Any tip's on making this a shorter program?

Complete! Screenshot

2
  • please dont ask questions in answers. and please dont paste screen shots of code. if you want to change the question, delete this answer and chagne the question and post the code here. NOT with a link and not with an image.
    – UpAndAdam
    Commented Sep 27, 2023 at 21:06
  • please dont ask questions in answers. and please dont paste screen shots of code. if you want to change the question, delete this answer and chagne the question and post the code here. NOT with a link and not with an image
    – guyewhite
    Commented Sep 29, 2023 at 0:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .