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!
Leave a Reply