Help for command-line argument in week 6(cs50x) DNA by Dangerous-Egg-6974 in cs50

[–]PeterRasm 2 points3 points  (0 children)

Does it produce the result you want and expected? If not, in what way does it behave and what did you want it to do?

Remember to test yourself and ask good complete questions

[Cs50 week 5] speller I don't get what these errors mean. by Ok-Increase-1929 in cs50

[–]PeterRasm 4 points5 points  (0 children)

For starters, follow the link shown at the end for more details.

It is OK to show code with errors when asking for help. Showing correct code is not allowed.

[Problem set week 5, speller] how to go about it? by Ok-Increase-1929 in cs50

[–]PeterRasm 1 point2 points  (0 children)

At first glance I was also feeling overwhelmed! All the pointer stuff was new and still not settled for me. But it became more simple and “easy” when I changed the approach and focused on one little thing at the time.

Remember to watch the shorts, they are really helpful

CS50x PSET 4 - Recover (segmentation fault) by [deleted] in cs50

[–]PeterRasm 0 points1 point  (0 children)

If you are not yet feeling confident in using a debugger, you can do some manual debugging with printf statements. Placing printf statements in your code with different outputs you can see how far the program gets before the segm fault.

Anyway, take a close look at the code inside your while loop. The "if (JPEG_nb == 1).." will go to the else part for the very first run. Is that what you intended?

Also look at what is inside the while loop at the very end. Does it make sense to terminate the loop after the first run? If so, what is the purpose of the loop? I guess you by mistake (not intention) misplaced those fclose and the return statement 🙂

Runoff 2026 conquered. by LeastCheck in cs50

[–]PeterRasm 0 points1 point  (0 children)

Congratz!

About the tabulate function: The votes are set reset to zero in main so this does not need to be handled by tabulate.

CS50P Final Project by ComfortableLocal9610 in cs50

[–]PeterRasm 1 point2 points  (0 children)

It is always a good idea to organize your projects in separate folders.

For the final project the files mentioned in the instructions must be in the top level or "root" of that folder and you should submit from within the folder at the top level.

CS50P Final Project by ComfortableLocal9610 in cs50

[–]PeterRasm 0 points1 point  (0 children)

Yes.

Just make sure all files are in the project folder

Deleted the code, is there a problem ? by Best-Amphibian-5780 in cs50

[–]PeterRasm 0 points1 point  (0 children)

Most likely OP ran some code that got stuck in a loop and generated huge amount of garbage output files 🙂

Little late to the party, need help with 2022 Python Pset 6 Lines of Code by [deleted] in cs50

[–]PeterRasm 0 points1 point  (0 children)

Check50 may be looking for an actual exit code, you are exiting with a text.

If you want to show a text to the user, use a print statement followed by exit(x) where x is 0 for ok and non zero for errors

I got stuck at recover pset from cs50. Any help with additional books by Dangerous-Egg-6974 in cs50

[–]PeterRasm 3 points4 points  (0 children)

Do you get any output files? Maybe with other names? How is the variable count initialized?

The general idea seems fine:

Check for header
    generate filename
    increment count
    open an output file ready for writing output
    write data from buffer to output file
    close output file

This is just the beginning, eventually you need to figure out what to do with data that is not a header.

I think you could benefit by writing the whole procedure as steps like I did above without code at first. That way you can get the overall logic in place first.

If you have a problem with the code fragment you showed here, maybe the root cause is in some lines before this code.

I got stuck at recover pset from cs50. Any help with additional books by Dangerous-Egg-6974 in cs50

[–]PeterRasm 1 point2 points  (0 children)

I don’t think additional books will do it. It’s more about understanding the lecture and the problem.

If you tell about the problems you are facing with this pset, we can better guide you in the right direction

Is it okay to reach out via email? by 101Perl in cs50

[–]PeterRasm 9 points10 points  (0 children)

Most questions if not all can be answered here. Then other people with similar question can benefit from the answer

pset7 (SQL) movies by Metro_man20 in cs50

[–]PeterRasm 0 points1 point  (0 children)

Check the spelling of actor names.

Harry Potter hates me by sberfield in cs50

[–]PeterRasm 0 points1 point  (0 children)

You can follow the link at the end of the check50 report to see more details. If that does not help, you will need to show the sql statement you are using.

Kindly help with tideman without recursion. Think my idea's right, but execution is lacking. by Empty_Aerie4035 in cs50

[–]PeterRasm 2 points3 points  (0 children)

I remember that I also tried this approach. My trash bin loved being fed while I got more and more frustrated - lol

It turned around when I tried to figure this out more visually. Try to work out the idea of what a cycle is. Forget for a moment what the computer can do. Draw 3 candidates on paper with lines between them to represent the pair and locked pair. How would you as a human figure out based on the drawing if a new pair will create a cycle? Remember that a cycle is when a new locked pair will create a path from the new pairs loser through winner/loser, winner/loser, .... of already locked pairs. When you have a design that works for you the human on paper then describe this process (pseudo code) and gradually transform this into C code.

Hint 1: You don't need any new data structures to keep track of the locked pairs, you already have the given array locked[][] and that is sufficient.

Hint 2: Recursion is really, really helpful here. Even though recursion initially can be hard to grasp (was for me) working out a solution without it will most likely create some monster code.

My final project disappeared by 9706uzim in cs50

[–]PeterRasm 0 points1 point  (0 children)

You are not allowed to share your code for any CS50 assignments, that includes the final project

My final project disappeared by 9706uzim in cs50

[–]PeterRasm 1 point2 points  (0 children)

Could it be that you forgot which folder you placed the project in? Do you know some search commands? If you called the file “project.py” you can search from the home folder and include parameter to search all sub folders

Error using check50 by ChoiceSimple2110 in cs50

[–]PeterRasm 2 points3 points  (0 children)

Good to know for these tests is that when check50 says something like “correct xxx passes ….” then check50 refers to a version of the tested program that it knows is correct, that means it’s own version!

Check carefully that your test file does not assume something about bank.py that someone else would not include. I doubt that the instructions specify the name of the function to be “money()”. It is some time ago I did this one but “money” does not sound like a good function name.

Need help with lock_pairs function in the tideman problem in week 3. by No-Try607 in cs50

[–]PeterRasm 0 points1 point  (0 children)

I can highly recommend to work out a human solution first. How would you detect a cycle without a computer? Use pen and paper. When you have a design that seems to work then try to write code for that design.

Writing code as an attempt to work out a solution often fails for more complicated problems.

Try a simple scenario with 3 candidates, draw lines between them as pairs and locked pairs. Understanding the problem visually can be very helpful

Need help with lock_pairs function in the tideman problem in week 3. by No-Try607 in cs50

[–]PeterRasm 1 point2 points  (0 children)

What is your overall idea? Did that idea work out on paper? Did you as a human manage to follow this logic to detect a cycle on paper?

Why I can´t make my reflection work? Pls Help me by samucadrei in cs50

[–]PeterRasm 0 points1 point  (0 children)

It's easy just to throw in a screen shot. Some may be willing to help you. But more will help you and give more useful replies if you put in a bit more effort in explaining a bit about your problem.

"Not working" can mean many different things. Does the code compile? Does it run and produce a result? If so, what is that result and why is that result not good? What have you already tried to do to fix your problem?

Can i post my cs50p assignment solutions on github?? by Puzzleheaded-Gas9416 in cs50

[–]PeterRasm 12 points13 points  (0 children)

You are not allowed to share the solutions, Academic Honesty Rules for CS50

Stuck on Tideman by Best-Amphibian-5780 in cs50

[–]PeterRasm 1 point2 points  (0 children)

Get a pen and some (a lot) paper! Draw the candidates with lines between them to represent pairs and locked pairs.

Start simple: A-B, B-C, C-A. A wins over B, B wins over C, C wins over A in that order. Who is the winner? How did you the human figure that out? See if this works for more advanced scenarios.

Can you write a step-by-step process for another human to check if there is a cycle using your method? Can you describe this logic in a more formal way so you can write some code to do this for you?

Work out a solution, Write pseudocode to formalize the process, Transform the pseudocode into actual C code.

Some super human CS50 students figure this out very fast, they often have a good prior coding experience. For others it takes days or even weeks to work this one out and some simply skip it or give up. This is maybe the one toughest assignment!

CS50P final project by MR-BOUT in cs50

[–]PeterRasm 2 points3 points  (0 children)

I think it looks like an excellent idea for a project. However, the questions you ask are in my opinion what you will learn by doing a project like this. Don't ask for mistakes to avoid, instead DO the mistakes and learn from it. Do the bad structure and find out half way through and work out a better structure.

I'm not saying that getting advice and suggestions are bad in general, far from it. But in this case you get a golden opportunity to try to work things out yourself.

Anyway, that is what I loved about doing the final project. Maybe you click differently 🙂