Need Help Understanding 'For Loop' in Pseudocode For Class Project

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

reddit.com
u/RyanTriggers — 11 days ago

Help Practicing Python

Hello!

I'm a first year Computer Science student learning how to program. The language we are going to be learning in my class (for first semester anyways) is going to be Python and I was wondering if anyone has any ideas on how I could practice python in my own time? Programming is something I am deeply passionate about and want to do good at, so I'm hoping I can get some help with this! :)

reddit.com
u/RyanTriggers — 2 months ago

Computer need Bitlocker code but can't find code

Not personally having this problem, but my significant other is.

When we went onto his computer a few days ago and we were greeted with the Bitlocker screen. We tried logging into every account on our phones that the computer could be under but all of our accounts either don't have a computer connected to them or not his computer specifically connected to them. Does anyone know how we could possibly get his key?

-It is a Windows 11 Laptop

-Started ~3 days ago

-Tried finding bitlocker key, but the computer is seemingly not connected to the account it should be connected to?

-Tried restarting, uninstalling any new updates, and manually shutting down the computer and starting it up again

-Microsoft says the computer isn't connected to any of the accounts that should be connected to the computer

-Cannot find Bitlocker key anywhere because of it

-Anything we've tried doing on the menu ends up not doing anything (ex. We tried restarting with and without saving files and both just did not let it happen.)

sry if this post is hard to read, I'm not used to making posts on reddit. I'll be checking the comments as much as I can so if anyone has any questions that might help please ask.

reddit.com
u/RyanTriggers — 4 months ago

Does Visual Programming Help With Growth?

To clarify: I'm going to college soon for computer science, specifically programming. Currently I am trying to learn some stuff on my own and was wondering if Visual Programming (building block code) will help me or not. It is easier to understand for me but I know its not something I will always have, kind of like training wheels, but I also feel like I'll never learn anything unless I code normally. Thoughts?

If this changes anything, I'm currently messing around in GameMaker and its coding stuff.

reddit.com
u/RyanTriggers — 4 months ago