Beginner Coding – Python

For this assignment I learnt the basics to coding. I previously competed with EV3 and I am equipped with a little bit of python coding skills. For review I decided to used a platform called replit.com and went through a tutorial called the 100 days of coding. Obviously, I didn’t have 100 days to complete the tutorial so I used it as as an easy review for my assignment.

Replit is a really nice platform for learning python, the tutorials were easy to understand and engaging, it also has an AI function that assists you while you code.

After some review, I figured I would code an age sorter that would label the user’s age as either child, adult and then ask for their favorite number.

Flow of the code:

Introduction: Greetings and ask for name and age

First function: Sort age into either adult, or child, or neither

Second function: Ask for favorite number then sort into even or odd

End: Thanks for using the code!

The code starts with an introduction then proceeds to gather the user’s name and age. It then saves the number and name into a variable and uses an if, else loop to determine the age bracket of the user.

Next, the check_favorite_number function gathers the user’s number, saves it in a variable, then divides by 2 to determine if the number is even or odd.

This is the last part of the function which runs the entire program and defines the function. It also ends the program with a print of the name gathered earlier.

This is the full code demonstrated

Coding seems to be a lot easier then the other assignments so far as the tutorial programs are more helpful and also applies a lot of logic and common sense.

Come try it out yourself!

https://replit.com/join/qwjmiwlkfe-joshuachen271


Comments

3 Responses to “Beginner Coding – Python”

  1. jtsai27 Avatar
    jtsai27

    ma

  2. mcrompton Avatar
    mcrompton

    Great post, Joshua! You have provided the essence of what I’ve asked for throughout. You’ve commented your code, provided demonstrations of the specific concepts I’ve asked for and provided a nice reflection on how this assignment fits into your previous knowledge. I love the flow description that you provide, even if it isn’t a traditional flowchart. The biggest thing that I’m missing is the ability to examine your code in detail. You have images of code fragments. That gives me a lot of information (if I zoom into the page), but I can’t actually run the code or copy and paste it into my ide to look at it more closely. Could you provide a link to the actual code or a shared, runable version in Replit? Resubmit when you’ve done that please.

    1. mcrompton Avatar
      mcrompton

      Excellent. Thank you, Joshua!

Leave a Reply

Your email address will not be published. Required fields are marked *