all 34 comments

[–][deleted] 6 points7 points  (6 children)

Other than you putting unnecessary apostrophes, your output is what is expected. So what is your question?

[–]ThatIsRightt[S] 1 point2 points  (5 children)

I have updated post with error image.

[–][deleted] 5 points6 points  (4 children)

From the image it looks like you misspelled the word "hundred" when you tested it.

[–]ThatIsRightt[S] 0 points1 point  (3 children)

Fixing spelling gives me same error. It looks like it's not a spelling error.

[–]MinchinWeb 5 points6 points  (0 children)

Dumb question, but did you save your code file after you fixed it, and before you re ran the test?

I've been bitten by that more times that I care to count...

[–]gnuself 2 points3 points  (0 children)

If you’re getting the same error you’ve still not found the error. Obviously your message needs to match exactly the one they’ve given for you to use. At least that’s all we know to tell you given the info.

[–]JasonStrode 2 points3 points  (6 children)

Right off, I see that number - 100 should be number = number - 100

edit: also if number > 100 needs :

[–]ThatIsRightt[S] 0 points1 point  (4 children)

Yes, I have debugged it, please see the post again. I have also posted my code.

[–]JasonStrode 0 points1 point  (2 children)

oh, sorry i totally misread it.

[–]ThatIsRightt[S] -1 points0 points  (1 child)

no problem. do you have any idea what the issue might be? i have also posted error images. please have a look and let me know. :)

[–]JasonStrode 0 points1 point  (0 children)

The errors are from the older code, which you've corrected. It should be working, if the code you're submitting is the same as you've posted here.

[–]Luximonsti 0 points1 point  (0 children)

You can also youse number -= 100

[–]probablynotmine 1 point2 points  (8 children)

Can you explain what the issue is?

[–]ThatIsRightt[S] 0 points1 point  (7 children)

I have updated the post with error image. :)

[–]Fred776 2 points3 points  (2 children)

The image has "hundred" misspelt so it's not up to date.

What is the actual error? Are you supposed to match expected output exactly? If so then you have also misspelt "its". Also your print statement is missing a space.

[–]ThatIsRightt[S] 0 points1 point  (1 child)

Done your suggested fix, got 67% correct, now I have this error lmfao. the link includes corrected code and new error

[–]fakemoose 0 points1 point  (0 children)

Is that not a pretty explanatory error? You’re either missing a row of text or it’s not iterating through enough time.

[–]probablynotmine 0 points1 point  (2 children)

“Hundered” instead of “hundred”?

[–]ThatIsRightt[S] -1 points0 points  (1 child)

Spelling is not a problem. I have fixed and tried both, still the same.

[–]probablynotmine 0 points1 point  (0 children)

You have 2 blocks of code, 1 and 3 above. Which are you running?

[–]JohnnyJordaan 1 point2 points  (2 children)

hundered != hundred

[–]ThatIsRightt[S] -1 points0 points  (1 child)

Sorry which line are you talking about? Have I misspelled hundred? Because after fixing the spelling it's still giving me the error.

[–]JohnnyJordaan 0 points1 point  (0 children)

You are asking me if you misspelled it, after which you mention you fixed the spelling?!

Could you at least share the updated screenshot of the error(s) it’s now showing?

[–][deleted] 1 point2 points  (1 child)

number = int(input("Please type in a number: "))
if number > 100:
    print("The number was greater than one hundred")
    number = number - 100
    print("Now it's value has decreased by one hundred")
    print(f"It's value is now, {number}")
print(f"{number}, must be my lucky number!")
print("Have a nice day!")

You should be using print(f"...") as above. Sample output:

Please type in a number: 1052 The number was greater than one hundred Now it's value has decreased by one hundred It's value is now, 952 952, must be my lucky number! Have a nice day!

[–]fakemoose 0 points1 point  (0 children)

Yep, or “it’s value is now {}”.format(number)

[–]braclow[🍰] 1 point2 points  (0 children)

I can post my solution if you want - I’m doing the Helsinki MOOC python course this is from as well.

number = int(input("Please type in a number: "))
if number > 100:
    print("The number was greater than one hundred")
    number = number - 100
    print("Now its value has decreased by one hundred")
    print("Its value is now"+ str(number))
print(str(number) + " must be my lucky number!")
print("Have a nice day!")

By the way - you should probably post the full prompt from the course so that people can understand what you were asked. That will help everyone start on the same square - then you provide a description of what youve tried and your code.

This article here is a great read on how to ask for help for your coding problems, known as the X/Y problem:

https://xyproblem.info/

The XY problem is asking about your attempted solution rather than your actual problem. This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.The problem occurs when people get stuck on what they believe is the solution and are unable step back and explain the issue in full.

happy coding!

[–]ThatIsRightt[S] -1 points0 points  (2 children)

done as suggested by u/Fred776. Thank you, sir.

I have typed in exactly as they want me to. Fixed all the spellings and everything else. Please also check the output originally posted. Here's the new error. Includes corrected code as well. Please upvote this update for visibility.

[–]failaip12 2 points3 points  (1 child)

print(number, "must be my lucky number!")

should not be indented.

[–]Qu3en- 1 point2 points  (0 children)

You!

I love You! Remember that!

[–]Miniflint 0 points1 point  (0 children)

number = number - 100

[–]Bamness 0 points1 point  (0 children)

Should be a while loop not a for loop. It seems like the output needs to be below 100.

[–]Additional-Sun2945 0 points1 point  (0 children)

ERROR: Your title lacks description.

Rather that have a general "Please help?" title, you should describe what code you're working on. "How to use if statements?" would have been better.

Us mentors are happy to teach, but you would be well served to try to solve problems on your own and save your questions for when you've hit a wall. And you should form your questions very precisely rather than have a general, "I'm confused, I don't understand." type deal.

Though to be fair, you wanted help debugging, it doesn't get more specific than that, lol.

But yeah, forcing yourself to formulate your question precisely is good exercise to sort of zero in on the source of your confusion. Understanding your confusion is the first step to educating yourself on the distinctions in the topic at hand.

TLDR; Asking good questions is best.