DEV Community

sheema
sheema

Posted on

Day 4: Leveling Up with Lists and Randomness in Python 🐍

I just wrapped up Day 4 of my Python journey! Today was all about moving beyond simple scripts and learning how to handle data more dynamically. It was a challenging day, but seeing the logic come together in the end was worth it.🧠
What I Learned Today Randomization: Using the random module to create unpredictable outcomes.Lists: How to store data in order, use offsets, and append new items.Index Errors: Learning the hard way that lists start at 0!Nested Lists: Creating lists within lists (basically making a grid or a map).πŸ› οΈ
The Projects

  1. Banker Roulette A simple script that takes a list of names and randomly picks who has to pay for the meal. No more arguing over the bill!

  1. Treasure Map : This was a cool exercise in nested lists. I built a 3x3 grid where you can input coordinates (like 23) to "hide" your treasure with an 'X'. It really helped me visualize how 2D arrays work.

  1. Rock Paper Scissors The "boss fight" of the day. I built a game where you play against the computer. Managing the logic for who wins based on the list index was tricky but fun.πŸ§—

The Struggle is Real I'll be honest: today was tough. There were moments where the logic for nested lists didn't click immediately. I used Chat GPT to help debug my errors and explain some of the more complex movements. It’s a great reminder that as a developer, you don't have to know everything instantlyβ€”you just have to know how to find the answer!

python #codingjourney #100daysofcode #learningtocode #programming

Top comments (0)