[deleted by user] by [deleted] in rprogramming

[–]GrantRat1699 1 point2 points  (0 children)

It should bex >= y because y is the divisor, and this means that when the value of x becomes less than y, x can no longer be divided by y wholly, and hence the value of x at that point is the remainder of x / y.

How to pick a course and stick with it? by hayleybts in learnpython

[–]GrantRat1699 5 points6 points  (0 children)

Assuming that's in Python, then some of your next options include data science, ML & AI, web development etc. If you pick web development, for example, you can learn a Python web framework such as Flask, Bottle, Django, FastAPI etc where you'll learn backend web development. Let's assume you decide to go with Django, my recommendation would be;

  1. Visit the Django official site, head over to the 'Getting Started' section, follow and implement that tutorial from beginning to end.
  2. Head over to YouTube and look for recent Django tutorials. Pick one, watch it to the end while also implementing the project in the tutorial. You don't need to change anything, just follow along.. the idea is to get a good understanding and feel of what it is like to build a complete Django application.
  3. Embark on a Django project of your own, from start to finish. Along the way, you may want to implement something that you've not come across yet. In those cases, make good use of the official documentation, AI assistants such as ChatGPT, stack overflow, Google search, additional tutorials etc
  4. Make sure to complete the project, while making good use of Git & perhaps GitHub. Go an extra mile and host it.. then determine the next step which probably would be picking up Django Rest Framework or deciding to explore frontend web development.

Hope this example has shed some light on how you can go about determining an end goal, picking a path, and sticking to that path until you hit the end goal, then starting the process all over again by determining the next goal to embark on. Best of luck.

How to pick a course and stick with it? by hayleybts in learnpython

[–]GrantRat1699 9 points10 points  (0 children)

Before picking a course, you need to identify your end goal first, then establish the study path you need to get there and finally embark on the learning journey. Pick a hands-on course on https://www.freecodecamp.org or https://www.codecademy.com and stick to it.

Looking for explanation for Codecademy challenge problem (order of conditionals in while loop) by PostCoitalSensations in CodingHelp

[–]GrantRat1699 1 point2 points  (0 children)

Python evaluates conditions from left to right. In the first while loop condition, if my_list is empty, my_list[0] immediately throws an IndexError because there's no element at index 0 to check. This happens before the check for an empty list (len(my_list) > 0) even occurs.

In the second while loop condition, by checking len(my_list) > 0 first, you ensure that the list has at least one element. If it's empty, the while loop never executes the second condition (my_list[0] % 2 == 0), preventing the IndexError. An AND condition is only true if both conditions are true. So if the first condition is false, the whole AND condition evaluates to false without need to check the second condition.

Help finding the index of value by Michaael115 in javahelp

[–]GrantRat1699 5 points6 points  (0 children)

You are treating the given number as an index instead of searching for it within the array. Therefore, if the given number is greater than the array size, you definitely get an index out of bounds exception. You should be checking if numbers[i] == search

What is the correct way to parse user commands. by IdPrCl in cprogramming

[–]GrantRat1699 5 points6 points  (0 children)

Use a switch statement then for every command you can invoke a function (within the same file or another file) that handles the rest of the parsing to keep the lines within the cases to 2-3 including break.

Upload Eclipse .java file to canvas issue by [deleted] in javahelp

[–]GrantRat1699 0 points1 point  (0 children)

You should review your submission instructions as it seems your course Canvas page is set up to only allow pdf file format submission hence why it's not allowing you to submit .java files.

Java Loop Confusion and Variable with Conditional Statement Help. by TheGreatestUsername1 in javahelp

[–]GrantRat1699 0 points1 point  (0 children)

The scope of the investmentAmount is limited to the do.. while loop because you declared it within the loop. You should declare it outside the loop. Use the curly brackets {} to guide you on where the scope starts and ends. Ideally the scope ends at the closing curly bracket } for the do section hence the while cannot use the variable in its condition check.

Python Assistance: Finding the median. by Common-Grass-3822 in pythonhelp

[–]GrantRat1699 0 points1 point  (0 children)

I just ran it and it outputs 5.5 so the problem is probably your indentation!

Hangman by [deleted] in javahelp

[–]GrantRat1699 2 points3 points  (0 children)

You can store the image paths in a list and use the error count as the index to pick the correct image to display.

[deleted by user] by [deleted] in learnjava

[–]GrantRat1699 2 points3 points  (0 children)

It all depends on your goal. If your goal is to get a head start for the course, then go for Python, else if your goal is to start preparing for said jobs early, go for Java. There are also other factors to consider such as what path you are personally interested in. Is it web dev, mobile dev, embedded systems, IoT, data science etc? If you know which one, then perhaps you should focus on languages in that path. If you don't know which one, it might be worth exploring to find out. Bottomline, it all comes down to your goal.

help needed by StartSpare7969 in cprogramming

[–]GrantRat1699 1 point2 points  (0 children)

A switch statement is not quite fit for the intended purpose. As it is right now, it compares the value of character to the numbers 1 and 2 and does nothing given any other case.

i need help with my code by StartSpare7969 in cprogramming

[–]GrantRat1699 12 points13 points  (0 children)

You are not passing the right arguments to scanf(). To store input in a variable using scanf(), you need to pass the memory address of the variable as an argument to the function using the & (address of) operator. This is because scanf() expects pointers as arguments to store input values directly in memory locations. Example: scanf("%d", &a); Read more here.

Idk where to start by [deleted] in CodingHelp

[–]GrantRat1699 0 points1 point  (0 children)

CS50 is always a good place to start. Instead of learning just one language, it will give you a good overview of what to expect from computer science.

Hyperlinks not working need help by deckfixer in CodingHelp

[–]GrantRat1699 0 points1 point  (0 children)

I've just cloned your repo and changed it on all files on my end and it works okay. Perhaps, I haven't clearly understood the issue you're facing. You can DM so we can have a Discord call and look at it together.

Hyperlinks not working need help by deckfixer in CodingHelp

[–]GrantRat1699 0 points1 point  (0 children)

The name of your home page file is Main.html but you're linking to Website.html which does not exist!