FAQ: Survey of Computer Science - The Tale of Kenny - Control Flow and Logic

Hi everyone, sorry i am new to coding and “Code Foundations” is my ever first coding course.

I would like to find out at this stage, am i suppose to understand how to code is being written?
or do i just play around it , following what the instruction said, "copy and paste python kenny_the_health_inspector.py". i manged to start running it in the bash.

(or) the aim of the slides are there just for us to understand the concept of the algorithm?

because at this stage, if the aim is to understand and knowing what each code and symbols mean, then i will have do find out what they are on google or youtube.

Hope someone can help with my questions. thank you all

I don’t believe you’re required to understand the code itself at this point, nor are the lessons set up in a way for you to learn it. It’d be best to just complete this course first and then consider learning an actual programming language with a course designed for that purpose as it’ll be much easier to follow.

I think the main point is that control flow is a useful tool with applications both in the real world and with programming. If you can start thinking in this way you’ll find it a lot easier to create more complex programs in the future. I don’t mean you have to analyse every scenario in life like this but understand that many things can be boiled down in this way allowing a similar logic to be applied to any programming you may do.

image

does anyone what these code really means? i have no idea what the following really means?
Q1: what is len( )? Does it means length?
Q2: print ("+str(i+1)" … what is str?
Q3: print("("+str(i+1)+") " + locations[i]+"\n") … what is the formula doing here? dont get the logic here . Hope someone can help

for i in range(0,len(locations)):
print("("+str(i+1)+") " + locations[i]+"\n")

You can find details of these functions, len() and str(), in the Python documentation-


As mentioned above if you wanted to learn Python as a language then look for a course which does that. Code foundations is the wrong spot to be learning the language itself.

bottom of the page you need to “Enter the number of your choice: -1”

Your options as far as bash and python are concerned are actually

(0) Billy’s …

(1) Lucy’s …

(2) Laura’s …

So your selection will pull from the above menu

Bump this post - it is the solution people are seeking. :wink:

1 Like

This worked for me!!

Thank you, I had trouble too running it but your advice helped and it’s now working.

I did a ctrl+f to find the word or title “bash” and there is not a word in that whole code titled bash so I don’t understand this exercise at all. Please instructors take note that this exercise is faulty. I shouldn’t have to start using a whole new browser psycicly for this program to work. Your coders should make it work throughout all programs. that’s your job.

Just copy this “python kenny_the_health_inspector.py” from the instructions and right click at the blinking dot in the bash working space and paste. Hit enter after and it should run.

This might be really silly but has anyone tried pressing enter after copying and pasting the code, I had the exact same issue as others who described that it doesn’t work, however after reading the text again it only says press run once.

“ Click run, then copy and paste python kenny_the_health_inspector.py into the terminal on the far right titled bash and hit return or enter on your keyboard”.

Hello @alashtal ,

ctrl + C, ctrl + V didn’t work for me either.

Did you try to copy it with your mouse (right cklick), and paste it with your mouse (right click again)?
This worked for me so the text showed up and I could hit enter which happened to start the game.

Hope this helped :slight_smile:

1 Like

The way for me was to type it in, so maybe we need to send ‘error’ request?

This is what worked for me, thanks!