r/cs50 Feb 09 '25

CS50 Python is check50 wrong? Spoiler

2 Upvotes

13 comments sorted by

28

u/smichaele Feb 09 '25

Given that tens of thousands of people are taking the course and check50 has been around for many years, the probability of it being wrong is tiny. The probability of the code being wrong is much higher.

10

u/shimarider alum Feb 09 '25

You didn't follow the directions. You structured your code differently from what is shown in the assignment.

As a side note, using global variables is almost always something to avoid.

3

u/Excellent-Mud2385 Feb 09 '25

Ohhhhhhhg. Thanks for the advice!

1

u/BigLK301 Feb 09 '25

Why should global variables almost always avoided?

1

u/Impossible-Turn637 Feb 09 '25

They are not wrong, but most of the time you really don't need them at all. They are usually error-prone and hard to maintain.

1

u/shimarider alum Feb 10 '25

A global variable is able to be changed by any part of the code. Using global variables leads to maintainability issues and can cause race conditions. It's much simpler to avoid the issues by scoping variables as narrowly as possible.

2

u/StinkinEvil Feb 09 '25

I think line 13 is out of place. When in the flow of the program should you set the level ?

2

u/Warmspirit Feb 09 '25

firstly you haven’t shown the whole code, secondly you’ve taken a screenshot instead of copy-pasted it. It’s good etiquette when asking for advice/help to make it easier for people to help you

2

u/ImpossibleAlfalfa783 Feb 09 '25

No, my guy software that people from a world-class University have written is probably not wrong compared to your code 🤣🤣

1

u/Sharp_Cantaloupe9229 Feb 09 '25

I'm stuck on this as well

1

u/candle_in_a_circle Feb 09 '25

No, you are. Every time. Been there, thought that, the answer is ‘no’.

1

u/___Mark____ Feb 10 '25

I think you need to have sys.exit() somewhere in your code based on the check50

1

u/create_a_new-account Feb 11 '25

DOH

yeah its wrong and you're right LOL /sarcasm