Learning How to Code Python Day 1-10

by Chris Latham | in January 2, 2022

  • Home
  • /
  • Blog
  • /
  • Learning How to Code Python Day 1-10

As you know I decided to learn how to code. If you want the full break down visit the previous post I created where I explain why I am learning to code, and why I chose Python.

And if you are up to date, dive in below for days one to ten.

Table Of Contents
show

Day 1

Learning to Code Python Day 1

Today marks the end of Day one in learning how to code Python. 

To get started, the first thing I did was log into an old FreeCodeCamp I made back in 2016. FreeCodeCamp is a non-profit program that aims to help people learn to code for free.

Why learn how to code, you may ask? The main reason is to improve my problem-solving skills by forcing me to think differently about problems. Plus, I always thought it was cool.

What I learned on day 1

I started off by getting 2 lessons deep in the FreeCodeCamp. The First lesson explained the fundamentals of what are variables, expressions, and statements.

Variables are a place where you can store data for later use, almost like a shortcut or bookmark in the browser.

name = "Mike G"
age = 72
Day 1 Coding Variables Chris Latham
Example of Python Variables

Expressions are values that are made of symbols, letters, and words. Expressions can either be an identifier or some kind of mathematical function. Pretty much anything that comes after the ‘=’ sign is an expression.

Statements are instructions, and they are a sequence of words and symbols that provides information about the problem you’re solving.

From there, I dove into a more hands-on youtube tutorial, ‘Learn Python – Full Course for Beginners‘ and dove right into creating. I have to say I definitely enjoy this style of learning as it forces me to figure out and connects the dots while executing. Often, that is the best way for me to understand what I am learning.

What’s funny is only after the 2 hours session did I realize that the video was from FreeCodeCamp.

Day 1 accomplishment

What I accomplished after Day 1 was in creating a basic arithmetic calculator. Take a look below at the first GIF I created.

Day 1 Basic Calculator Chris Latham
Basic Arithmetic Calculator

After the first day, I realize my best plan of action is to spend the first half of my time doing the course and learning all the fundamentals. Then I spend the last half of my time learning through building and writing code.

Day 2

Yesterday I learned about Variables, Expressions, Statements and made a calculator.

What I learned on day 2

Today’s lesson was about Conditional Execution and the famous IF statement.

Using IF statements will help the program make decisions. We need to create a variable to get this done, then tell the program what to do.

Say I create a program that wants to know if someone is above 18. I want the program to spit out the phrase ‘legal’ if they are 18 and older, and if they are under 18, it will say ‘underage’.

We would need to create a variable and give it a value to get that done. 

I will use the variable ‘age’ and assign it the value of ’18.’

age = 18

Then I need to implement conditional execution to guide the program on what to do.

The first thing I want to do is let the user enter their age.

age = input("how old are you: ")

Then I want the program to read the number they input and spit out either the word ‘legal’ or ‘underage.

For that I have:

if age < str(18):
	print("underage")
if age >= str(18):
	print("legal")

When I put it all together it looks like this:

age = 18
age = input("how old are you: ")
if age < str(18):
	print("underage")
if age >= str(18):
	print("legal")

When you let that run you get the following:

Day 2 Age Verification with Python Chris Latham

I have to say I am quite proud I did the above without using my notes. When I read this sentence back after day 100, I’m sure I will have a good laugh. But hey, no matter how big or small the win, I have to celebrate them regardless.

Day 2 Accomplishments

Today on the practical side of things, I learned to build a guessing game. The game’s premise is you have three tries to guess my favourite fruit. If you guess the answer correct in three attempts, you’ll read the message “You win!”. If you get it wrong after three tries, you will get the message, “You are out of guesses. Sucks to be you.”

This is what it looks like:

Day 2 Guessing Game with Python Chris Latham

Today’s big takeaway is that you have to blend practical work with studying no matter your learning style. You got to get intellectual and physical. If you are not, then you risk only having intellectual entertainment.

As much as I would love to claim that quote, I heard it first from Nishant Kasibhatla. You can watch a dopeĀ video of him here. The crazy thing is the video came out the same day as I wrote this. Talk about perfect timing.

Follow the journey and see what happened on day 3.

About the author 

Chris Latham

RELENTLESSLY CURIOUS are the two words that describe me best. I enjoy finding solutions for seemingly big problems. I live my life constantly seeking new experiences. This is all driven by a child-like curiosity for people, places, and things.

More To Explore

January 21, 2022

January 6, 2022

January 3, 2022

Get Dope Updates on What I Have Learned!