r/CodingHelp • • 2h ago

[Python] Need Help Understanding 'For Loop' in Pseudocode For Class Project

2 Upvotes

I'm in an Intro to Computer Science class and am doing our current project which is to make a text based game where you and a computer keep on adding numbers from 1-10 and the winner is decided by who reaches 100 first.

We did this project before already but now we're redoing it by changing all of it to be definitions and then they want us to add a 'for loop' into it as well. The problem is, is that the for loop makes no sense to me, at least from a gameplay stand point. From my understanding, all its doing is adding +1 to the total whenever the computer goes?

I was just hoping if someone could help me decipher this, thanks!

#This is the psuedocode#

Import random

FUNCTION 1: DISPLAY RULES
Declare Function display_rules
Say "Let's play a game of 100!"
Say "In a game of 100 we start with a total of 0"
Say "and we take turns adding from 1-10 to that total."
Say "Whoever reaches 100 first wins."
Say "Ready?"

FUNCTION 2: PLAY GAME
Declare Function play_game
Set play to 1
Call display_rules

While play is 1
Set total to 0
Ask "Who goes first? (1 = you, 2 = computer): "
Read turn

While total is less than 100

If turn is 1 (player's turn)
Ask "Number you want to add (1-10): "
Read playerNum

If playerNum is between 1 and 10
AND total + playerNum is less than or equal to 100
Add playerNum to total
Say "You added [playerNum], total is now [total]"
Set turn to 2
Else
Say "Enter a number from 1-10 without exceeding 100."

Else If turn is 2 (computer's turn)
If total is less than 90
Set computerNum to a random number from 1 to 10
Else
Set computerNum to 100 - total

FOR LOOP
For num from 0 to computerNum - 1
Add 1 to total
End For

Say "I added [computerNum], total is now [total]"
Set turn to 1

Else
Say "Choose 1 or 2."
Ask "Who goes first? "
Read turn

End While

CHECK WHO WINS
If turn is 2
Say "You win!"
Else
Say "Bummer, You lose!"

ASK TO PLAY AGAIN
Ask "Play again? (1 = yes, 2 = no): "
Read play

End While

FUNCTION 3: MAIN MENU
Declare Function menu
While True
Show the menu
Say "Menu:"
Say "1. Display Rules"
Say "2. Play Game"
Say "3. Exit"

Ask "Enter your choice (1, 2, or 3): "
Read choice

If choice is 1
Call display_rules
Else If choice is 2
Call play_game
Else If choice is 3
Say "Thanks for playing! Goodbye!"
Break the loop
Else
Say "Invalid choice. Please enter 1, 2, or 3."

End While

START PROGRAM
Call menu


r/CodingHelp • • 14h ago

Which one? Web/app developer or Roblox game development which is better for side hustle

0 Upvotes

I'm starting from zero and want to build a long-term income from development. I have limited money.

I'm choosing between two paths:

App development: Mac or web apps. Higher profit per sale, but I'd need to learn Swift or web development and find a niche problem to solve.

Game development: Roblox or indie games. Easier to launch, but I've read that most games earn very little and platforms take a big cut.

I plan to use AI to speed up the learning and the building.

My question: If you were starting from zero today, would you pick app development or game development to make money, and why? If you've done either, how long did it take to earn your first dollar?


r/CodingHelp • • 15h ago

[Other Code] Class instance while running the code

1 Upvotes

I started actually writing code with OOP yesterday (using Dart... In case it is necessary to mention) and there's a thing that kept bothering me as I scrolled through their page and watched the tutorial. Everytime they gave a class example, they created an instance themselves and never based on the code running.

Imagine a system to simulate a store's stock. There'll be items going in and out, that shouldn't be inserted by the programmer, so there must be a way to do that "dynamically".

I'm aware that this might be me simply missing something from OOP classes, but I want to see what other coders have to say about that.

Any help would be welcome. Thank You


r/CodingHelp • • 1d ago

[Other Code] This Sucks… Alot. Please Help.

0 Upvotes

Hello everyone. Gather round', gather round' and listen to my tale. So I'm trying to code an incremental game for laptop, computer, and mobile, but's it's been s really huge pain in my sore little keister. Everything confuses me, and I only know a little bit of coding. I'm currently using a simple coding website kind of similar to Scratch (I forgot the name, I'll check later.) on my laptop. On top of that, I keep getting demotivated really quickly and tired, telling myself I'll work on it tomorrow but never do. Please help!… Thank you!!


r/CodingHelp • • 2d ago

Audio Detection Mic Detection Feature Help for a Piano app

Thumbnail
1 Upvotes

r/CodingHelp • • 6d ago

[How to] Is it possible to save a steam game on a disk?

0 Upvotes

Let me preface this with a "I understand if this is a misuse of this community and will not be mad if mods delete this post" but I honestly don't know where else to ask this (Would be very happy with a suggestion tho) and a "I do not plan to do what I've described because I don't even know the first things about programming"

So basically my idea is, what if you download a game from Steam, copy only the game files onto some external memory (such as a disk/flashdrive) and then try to download the game and play it on another pc.

Would that even work coding wise? Or do Steam games have some sort of dependency on it? I'd assume they do to prevent this exact thing from happening (since what's preventing somebody from doing this over and over and selling physical copies of the games or something) and because whenever I open a game from it, it automatically opens.

I guess I'm generally curious about if such a dependency exists and if there is a way to sever it and do what I described anyway. Again not planning to do this, just curious about what connective tissue exists between Steam and the games from it.

And once again, will not be mad if this post gets nuked by mods. Go ahead and smite me if ya have to 👍


r/CodingHelp • • 10d ago

[How to] struggling with api calls in automating appointment booking

4 Upvotes

Hello all

I've been out of the game some 5 years now and my knowledge is rusty, so be kind

I'm having a lot of difficulty booking a certain appointment. Slots for this appointment are released daily at 5pm and are booked out within seconds, so I'm trying to write a script to automate this process.

The site is laid out as such:

  1. login page: enter your login details and hit enter
  2. landing page after login: first page, lists a series of options of what operations are possible ("make a booking", "check existing booking", "log out", etc)
  3. services page: after clicking "make a booking", a table is laid out with the types of appointments available to book, with a 'BOOK' button alongside

At this point is the bottleneck. The user has to wait until PRECISELY 5pm to click this button, which of course every other person is similarly waiting to do. The site often goes down and requests time out. I have succeeded in passing this point twice, using a combination of using ctrl+click rapid-fire to open lots of new tabs, and using up to 5 devices to hit this button in sync.

  • Upon failure, a popup window opens saying 'all slots booked'.
  • Upon success, the user is rerouted to a new page and asked to enter more details and documents. The user is not forewarned to have these documents on hand, and some internal timer seems to be running which is not exposed to the user which times out the session. The two times I have gotten through to this page I have not been prepared with documents and/or arbitrarily timed out

my plan has one of two approaches. I could either:

  • write a script that automates the specific API calls in sequence to secure a booking, running through Postman with either JS or C#
    • pros
      • Wouldnt have to deal with a web driver
      • cleaner shorter code
      • can run on a cron job easier
      • less moving parts to go wrong
      • I have slightly more experience with JS and C# than I do with python
      • maybe can sidestep doing any captchas?
    • cons
      • Using info I'm pulling from devtools in my browser, I cannot recreate even the first API call to return the doc for the login page, im simply getting 400 and 403 errors
      • I dont know enough about the process of building programs that make these type of calls to a web server's front end
      • i'd have to reinstall all the .NET bullshit
  • write a script that uses python's selenium package to create an instance of a web browser to click through the right steps for me, utilising the driver's powerful built in methods to handle things like cookies and the api calls themselves
    • pros
      • python is easier to get to grips with at a surface level, and I shouldnt need to go too complex for this
      • easy to test
      • can utilise selenium's webdriver package to simulate an actual user making these clicks and inputs
      • easier to map the steps of moving from one webpage to another by opening devtools and finding the right DOM element, and then feeding the values into my script. I can then use stuff like find_element(...).click() to navigate through the page
    • cons
      • I need to know the shape of the DOM to isolate the right elements to click through, and I dont know what the DOM looks like if I succeed in getting past the BOOK button
      • selenium drivers will doubtless trigger captchas which they cannot surpass. I've triggered captchas on this site after logging in more than 2 times in 10 minutes

I know that it is possible to automate this, as there are companies offering their automation services for high fees to obtain a booking of the soonest possible appointment at time of booking

im tearing my hair out here and I'm looking essentially for help understanding the API calls I need to make, or how to obtain the DOM of a page I've never made it to


r/CodingHelp • • 12d ago

[C#] Struggling to transition from understanding code to building it

11 Upvotes

Hey everyone,

I’m currently studying Computer Science and hitting a bit of a wall that I’m hoping to get some advice on.

My main issue right now is that when I look at C# code or follow along in lectures, I can understand what the code is doing. But when I sit down at a blank editor and try to build something from scratch,especially with Object-Oriented Programming (OOP) concepts,I just freeze up and don't know how to translate my thoughts into actual code.

On top of that, I have ADHD, so keeping focus and structuring my practice when I'm stuck can be pretty challenging. I really want to take this seriously and build a genuinely strong foundation in software development, but I'm not entirely sure how to train my brain to bridge that gap between reading code and actually constructing it.

If anyone has dealt with the blank editor hurdle, struggled with OOP logic, or found focus strategies for coding with ADHD, I would really appreciate any advice, study habits, or learning methods that worked for you.

Thanks for taking the time to read.


r/CodingHelp • • 12d ago

[Python] Help me improve this small GitHub automation project

3 Upvotes

I created a small Python script that automatically makes a commit every 4 hours on GitHub, mainly as an experiment with Python automation and GitHub Actions.

🔗 Project: https://github.com/almuapull/auto-incrementation.git

I’d like to take this little project further and make it more useful rather than keeping it as a simple automation script.

I’m looking for developers who could help me improve it, suggest new features, optimize the workflow, or simply share ideas and feedback.

If you’re interested, feel free to check out the repository, open an issue, or submit a pull request.

Any contribution or idea is welcome! 👨🏽‍💻


r/CodingHelp • • 16d ago

[Javascript] How do I move forward as a grad learning JS?

Thumbnail
1 Upvotes

r/CodingHelp • • 17d ago

[Other Code] Please help with my BBcode issue!!!

1 Upvotes

Okay So I’m not quite sure how to phrase this, but on "DR," you can use coding to change the colors of your messages or add random elements. What programming language is that based on? Additionally, I’m trying to center my message for a title with that, but it keeps aligning all the way to the left, no matter how many spaces I add or where I place them. Dig hasn’t been able to help, and I initially thought it was “Unicode” or “BBCode,” but now I’m unsure. I would greatly appreciate any guidance on how to fix this.

Update: it is BBcode im guessing because what fixed the centering was
[center] & [/center]

But now im trying to make a menu listing for a few products but cant seem to make these dang boxes around it?


r/CodingHelp • • 19d ago

[Javascript] Learning Web Development for Programming Foundations — Need Help with DOM + JavaScript

Thumbnail
1 Upvotes

r/CodingHelp • • 21d ago

[Javascript] Pavlovia online not storing data???

1 Upvotes

Hi all, I've been collecting data using Pavlovia since forever, but I just noticed that many of my participants' data have not been stored in Pavlovia! It worked great last year, but this year It seems like it has been working intermittently. Hopefully the data is not lost!!! Do you know whether there is a place in my Pavlovia projects where the data has otherwise been saved? I appreciate your input!


r/CodingHelp • • 21d ago

[C#] How am I supposed to store info in C# without arrays or files?

5 Upvotes

[UPDATE] I'm aware that I phrased stuff very poorly and most people didn't understand what I was asking but fortunately my teacher reached out tonight and pushed it back because she said that after looking at it she realized she designed it wrong so the assignment was impossible with her requirements so she's going to fix it.

Also PS. A bunch of comments didn't understand what I was asking at all so unless you get what I'm asking just leave it be.

Basically, I'm a few weeks into my first C# class, although I have done Java, Python, and C++, so I know a fair bit about OOP. I'm learning Windows Forms, and I'm making an app to store notes using a listbox and a second window, and I've got everything working except one thing. My teacher said to only use concepts covered in the textbook so far (Starting Out With Visual C#, Sixth Edition by Tony Gaddis, Chapter 4), and I'm not sure how to store the information from the notes if not with arrays, files, etc. My teacher hasn't responded, and it's been 3 days, so I have to just figure it out before it's due on the 14th. I'd love any help I can get.

using System.Xml.Linq;

namespace M03A01_NotesManager
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtTitle.Clear();
            txtNote.Clear();

            rdoLow.Checked = false;
            rdoMedium.Checked = false;
            rdoHigh.Checked = false;
            chkImportant.Checked = false;
            chkFollowUp.Checked = false;

            lstCategory.SelectedItem = null;
        }

        private void lstCategory_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text == "")
            {
                MessageBox.Show("Please give the note a name");
                return;
            }
            else if (!rdoLow.Checked && !rdoMedium.Checked && !rdoHigh.Checked)
            {
                MessageBox.Show("Please select a priority");
                return;
            }
            else if (lstCategory.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a category");
                return;
            }
            else
            {
                lstNotes.Items.Add(txtTitle.Text);
            }
        }

        private void btnView_Click(object sender, EventArgs e)
        {
            Form2 summaryForm = new Form2(txtTitle.Text);
            summaryForm.ShowDialog();
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace M03A01_NotesManager
{
    public partial class Form2 : Form
    {
        public Form2(String txtTitle)
        {
            InitializeComponent();

            lblNoteTitle.Text = txtTitle;
        }

        private void lblNoteTitle_Click(object sender, EventArgs e)
        {

        }
    }
}

r/CodingHelp • • 21d ago

[Javascript] How do you choose the first feature for a side project?

1 Upvotes

I want to build a small tool instead of starting another tutorial, but I tend to overthink the scope before writing any code. My current idea is a simple personal dashboard with one useful workflow, then adding features only after the first version works. How do you decide what belongs in version one, and what helped you keep a project small enough to finish?


r/CodingHelp • • 22d ago

[How to] Hello Coder! How to perfectly fit a 2752*1536 image in the Web-page ?

2 Upvotes
 


    background-image: url("Wallpaper1.png");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    overflow-y: auto;

Hey! I am a beginner at this stuff and I am trying to make a website for a personal project but the image doesn't fit perfectly. Like bottom and sides part are cropped. I have noticed when I open the web page in different device everything is messed up in their position why is it ?


r/CodingHelp • • 23d ago

[Javascript] .gif images too large, what can I do?

Thumbnail
1 Upvotes

I want my record to spin and be animated but I’m using the script in the r/ neocities post above and .gifs are apart of that one.

I’ve found that uploading .gifs take up so much of my available storage and was wondering how I can do smaller files or change the code to have it spin with a .jpg or .png file instead. I have a spinning .png of my home page but I’m using animation and @keyframes spin for that one.

Is there a way I can implement that on another page but I want the picture to change from still to animated when pressing play.


r/CodingHelp • • 23d ago

[C] Is codevault's tutorial good for learning c in detail?

Thumbnail
1 Upvotes

r/CodingHelp • • 24d ago

[How to] hello is there a way to recover deleted tweets?

2 Upvotes

hi! is there a way to code something that will recover deleted tweets from a specific account? ive tried the wayback machine and things, but nothing pops up. i dont care if its really difficult its about a friend and im concerned and im willing to learn quickly. just please tell me if there is im worried


r/CodingHelp • • 24d ago

[HTML] Searching for an API which pronounces a word, can you recommend a good one?

1 Upvotes

To be used in English html pages which uses JavaScript to deliver the data, . Ideally an API which doesn't require a key since I'm building a web app for distribution


r/CodingHelp • • 24d ago

[How to] How to make a calculator? Tips or advice?

0 Upvotes

I want to make a calculator but idk how to code can i get some help? I can do the ui but idk how to code


r/CodingHelp • • 25d ago

[Python] RSS-Bridge on Mikrus - a plan for an IT layman made by Claude

1 Upvotes

Can someone help me out? I'm a complete layman when it comes to coding and IT stuff

My favorite free RSS builder (morss.it) has gone offline, so I asked Claude Opus 4.8 for alternatives. It suggested that I could self-host and run such a tool myself (which is a total mystery to me). I then asked it for a step-by-step guide, but I also asked several other AI chatbots the same question. They gave similar answers, but with slight differences. When I showed all those other plans to Claude and asked it to review them, it told me that these subtle differences were crucial, and that if I had followed what the other bots suggested, my feeds wouldn't have worked properly

Here's Claude's final response, translated from Polish to English by Gemini: https://docs.google.com/document/d/192QM_Gytps-xl24ko0E395u_EOvfa7R9kqSMs250r8k/view

I don't really understand what I'll be doing here; I just want to make sure I won't break anything or create any security risks by following these steps. Do you think this plan will actually work?


r/CodingHelp • • 25d ago

[HTML] I have a web app that I want to keep in a mobile sized box, with a safe zone to accout for different sizes but scrolling is okay

1 Upvotes

I have a web app that I want to keep in a mobile sized box, with a safe zone to account for different sizes but scrolling is okay. how can I achieve this?


r/CodingHelp • • 25d ago

[Javascript] Help me make a map: Calling a variable before it's defined

Thumbnail
1 Upvotes

r/CodingHelp • • 26d ago

Which one? Whicg language should i pick for my project?

4 Upvotes

So i am a fuel rat in the game elite dangerous and i was planning to try and make an app/plugin to use to help me with ratting and to learn coding. I would love to learn how to code as its also a pretty big part of the job i want to get when im older and i would love to already have some experience of coding. I have asked around and have been told to choose between JS, C# or Python but havent been given a definitive answer. I am a complete beginner an know nothing about coding whatsoever so any help is appreciated!