DEV Community

Cover image for What I learned in Week 1
Om Kolhapure
Om Kolhapure

Posted on

What I learned in Week 1

What I Learned in Week 1 of Python — And Why I'm Already Hooked

I've been saying "I'll learn to code" for two years.

Last Monday, I actually did something about it.

No bootcamp, no cohort — just Python, VS Code, and a stubbornly blank terminal staring back at me. Seven days later, I've built a calculator, a number guessing game with difficulty levels, a password validator, a multiplication table generator, and a full text-based adventure game with rooms, inventory, and a win condition.

This is what Week 1 actually looked like.


Day 1 — Hello, World (and Hello, print())

Before writing a single line of Python, I spent way too long on setup — installing Python 3.12, VS Code, the Python extension, figuring out why the terminal wasn't running my file. The setup tax is real.

But once I got there, I didn't just write one print() and move on. I explored every way Python can greet someone:

#My first python code
print("Hello, World")
#Making a greeter!!
#Ask user for his/her name
name = input("What's your name? ")
#methods to display the greeting on the screen as hello, name(whatever the name might be)
#explicitly mentioning value of end in print function
print("Hello, ", end = " ")
print(name)
#Giving two arguments to the print function
print("Hello,", name)
#Concatening Strings
print("Hello, " + name)
#Using f-strings
print(f"Hello, {name}") #The most commonly used one
Enter fullscreen mode Exit fullscreen mode

That last one — the f-string — immediately became my favourite. It reads almost like writing a sentence with blanks. I didn't expect Python to feel this close to plain English on day one.


Day 2 — String Methods and the Beauty of Built-ins

Day two was variables, data types, and getting comfortable with what Python can do to strings out of the box. I wrote a small methods playground:

word = "library"
print(word.strip())      #Strips all the white spaces from left and right side of a str
print(word.capitalize()) #Capitalizes only first letter of the first word
print(word.title())      #Capitalizes first letter of every word
print(word.split()) #spits the word at whitespaces and returns an array of substring
print(word.split("r")) #splits the word at every r it will encounter 
print(word.split("r", 1)) #splits the word from the first r it encounters

#The above methods can also be written in the following way
print(word.split().title().split("r", 1))
Enter fullscreen mode Exit fullscreen mode

What surprised me: how many useful things are just built into the language. No imports, no setup — just word.something() and it works. Coming from zero experience, that felt like a generous head start.


Day 3 — User Input + My First Real Program

This was the day things started feeling real. I built a calculator — and pushed it further by adding input validation so the program doesn't crash on bad data:

#Asking for input from user
x = input("What's x? ")
y = input("What's y? ")
#Check if the user's input is a digit
if x.isdecimal() and y.isdecimal() :
    x = int(x)
    y = int(y)
    #Display arthematic opreations on the screen
    print(x + y) 
    print(x - y)
    print(x * y)
    if y == 0 :
        print("Cannot divide by zero")
    else:
        print(x / y)
else:
    print("Invalid input!!")
Enter fullscreen mode Exit fullscreen mode

The isdecimal() check came from Googling "how do I stop Python from crashing when someone types letters." That one search taught me more than an hour of reading would have.

Tiny win: Handling division by zero before Python could throw an error felt like writing my first real defensive code.


Day 4 — Conditionals and a Game With Difficulty Levels

if, elif, else. The traffic lights of programming.

I built a number guessing game — and pushed it further by adding difficulty levels and Python's match statement, which I stumbled onto and immediately loved:

import random

#declaring game state variable 
gameRunning = True

#Ask the user for difficulty and then set the range according to the difficulty selected
difficulty = input("Choose difficulty:\n\tEasy\n\tMedium\n\tHard\n").title()
x = 1
match difficulty:
    case "Easy":
          y = 100
    case "Medium":
         y = 500
    case "Hard":
         y = 1000
    case _:
        print("Invalid input: Please select from the given choices!")

#Generating random number and storing it in a variable
randomNumber = random.randint(x, y)
#Asking the user for input of the number
number = int(input("What's the number I am thinking about?: "))
#Tracking attempt's taken by user to guess the number
attempt = 1

while gameRunning == True:
    if number == randomNumber:
        print("Correct, you got me!")
        gameRunning = False
    elif number > randomNumber:
        print("too high")
        number = int(input("Guess Again: "))
        attempt += 1
    else:
        print("too low")
        number = int(input("Guess Again: "))
        attempt += 1
print(f"You took {attempt} attempts to guess the number!")
Enter fullscreen mode Exit fullscreen mode

I played Hard mode probably ten times before moving on. When you build something fun, the learning sticks.


Day 5 — Loops: Two Programs, One Concept

Loops were the first concept that made me genuinely pause. for clicked fast. while required me to think differently — "keep doing this until something is true."

I built two programs to drill both.

Multiplication Table Generator

#setting an active flag
active = True
#Using while to run the generator as long as the user wants
while active:
    #Take input from the user
    #check if it is positive if not prompt the user Again
    while True:
        number = int(input("\nEnter a number: "))
        if number > 0:
            break
    #Using for loop iterate generate the multiplication table
    print()
    for i in range(10):
        print(f"{number} * {i + 1} = {number * (i + 1)}")
    print()
    #Asking the user if he wants to continue??
    repeat = input("Do you want to enter another number(yes/no)? ").lower()
    if repeat == "no":
        active = False
Enter fullscreen mode Exit fullscreen mode

Password Validator

#Adding a error1, erro2, erro3 variables to make the code readable
error1 = "\nThe password must atleast be 8 characters long"
error2 = "The password must contain atleast an uppercase letter and it must be alphanumeric"
#print the criteria and check if the given password meets the criteria
print("The following is the criteria for a Strong password:")
print(f"{error1}\n{error2}")
while True:
    password = input("\nEnter your password: ")
    #The password should be 8 characters long
    # it should have a uppercase letter and it should be alphanumeric
    if len(password) >= 8 and any(char.isupper() for char in password) and any(char.isdecimal() for char in password):
        print("\nCongrats!, it's a strong password")
        print()
        break
    else:
        print(error1,error2, sep = "\n")
        print()
Enter fullscreen mode Exit fullscreen mode

The any() function was a side-discovery here — found it while looking for a clean way to scan every character in a string. Those little finds while building are my favourite part of self-learning.


Day 6 & 7 — The Project: A Text-Based Adventure Game

The end-of-week project was the most fun I've had coding so far. I built a full game called The Abandoned House:

  • 🗺️ Three rooms to explore (bedroom, kitchen, living room)
  • 🎒 An inventory system — flashlight in the bedroom, key in the kitchen
  • 👹 A random beast that kills you if it appears in your room
  • 🏆 A real win condition — collect both items, reach the living room
  • 🔁 A retry option when you die

Here's the full code:

import random
#set gamestate
game_state = True
#player location
player_location = "bedroom"
#Adding tools
tools = {"bedroom": "flashlight", "kitchen": "key"}
inventory = []
#Adding locations
locations = ["bedroom", "kitchen", "living room"]

def main():
    start_game()
    if not game_state:
        return
    print_story()
    while game_state:
        #location printing
        #check for items 
        #pickup if there
        # where to?
        if not game_state:
            break
        print_location()
        move_player()
        if not game_state:
            break
        game_end()

def start_game():
    global game_state
    game_menu = input("\n\tThe Abondoned House\n\n\tStart\n\tQuit\n\n").title()
    if game_menu == "Quit":
        print("\nQuitting....")
        game_state = False
    else:
        print("\nLoading...")

def print_story():
    print('''\nIt's midnight, I am driving on a narrow road in the middle of a forest; Oh shit
I just hit something. (opens the car door and steps out looks behind, but sees
no one confused as he turns back to get into his car) Ahhh..... (Get hits by 
someone in the head and becomes unconcious After a while...) Where am I??(Wakes up in a room)
, I have to get out of here!")''')
    return

def print_location():
    global player_location
    print(f"\nI'm in the {player_location}")

def move_player():
    global player_location
    while True:
        go = input("\nWhere would you like to go?\nbedroom\nkitchen\nliving room\n\n ")
        if player_location == go:
            print(f"Already in {player_location}")
        else:
            player_location = go
            print_location()
            beast()
            if not game_state:
                break
            check_up()
            break

def beast():
    global player_location
    global game_state
    beast_location = random.choice(locations)
    if beast_location == player_location:
        print("you are Dead")
        retry_input = input("Would you like to play again?(yes/no) ")
        if retry_input == "yes":
            move_player()
        else:
            game_state = False
    else:
        print("growlssss.........The beast is nearby")

def check_up():
    global player_location
    if player_location in tools:
        pick_up()
    else:
        print("There is nothing useful here!")

def pick_up():
    pick = input(f"Would you like to pickup {tools[player_location]}?(yes/no)? ")
    if pick == "yes":
        print("Picking up...")
        inventory.append(tools.pop(player_location))
        print(f"inventory updated: {inventory}")
    else:
        game_end()

def game_end():
    global player_location
    global game_state
    if "flashlight" in inventory and "key" in inventory and player_location == "living room":
        print("I am finally out of this house!")
        game_state = False
    else:
        print("I am missing one more thing!")
        move_player()

main()
Enter fullscreen mode Exit fullscreen mode

The moment the win condition triggered for the first time — "I am finally out of this house!" — felt like a genuine milestone. This wasn't a tutorial I followed. I built this.


📁 What I Built This Week

Project File Concepts Used
Hello World + Greeter hello.py print(), input(), f-strings
String Methods Playground methods.py String methods, data types
Calculator calculator.py input(), if/elif/else, isdecimal()
Number Guessing Game guessTheNumber.py while, random, match, conditionals
Multiplication Table table.py for loop, nested while
Password Validator password.py while, any(), string methods
Text Adventure Game game.py Functions, global state, everything above

All the code is on GitHub — every file, every day:
👉 github.com/Omk4314/progress-on-python

I'm committing daily — even the messy days.


What Actually Clicked This Week

  • Python reads like English. I expected gibberish. I got readable logic.
  • Building > drilling. The calculator taught me more than ten isolated exercises ever could.
  • Errors are clues. Once I stopped panicking at red text, debugging became a puzzle, not a crisis.
  • match is underrated. I stumbled onto it and immediately liked it more than long if/elif chains.
  • Momentum matters. Day 1 was rough. By Day 5 I was genuinely looking forward to opening the terminal.

What I Want to Learn Next

Week 2 is going to cover:

  • Functions properly — I've been using them without fully understanding the mechanics
  • Lists and dictionaries — my adventure game needed them and I can feel the gap
  • Basic file I/O — so my game can actually save progress
  • Maybe some OOP — no promises, just curiosity

If you're also learning Python from scratch, I'd love to see what you're building. Drop it in the comments — beginner projects deserve to be seen.

See you next week. 🐍


Week 1 complete. The terminal no longer scares me. That's enough for now.

Top comments (0)