# 💻 Day 1: Welcome to Coding — HackMD Learning Log ## 📅 Date 2025-06-09 ## ✅ Challenge 1 ### 📱 Age Calculator (with current year) ```python import datetime today = datetime.date.today() current_year = today.year birth_year = int(input("What year were you born? ")) age = current_year - birth_year print(f"You are {age} years old in {current_year}! ``` #### 📖note `int()`:Convert to number `str()`:Convert to string `input()`:Get user input f-strings:print(f".....<font color="#66ccff">{container}</font>......") ## ✅ Bonus ### 🙋‍♂️Welcome Function ```python def welcome(name): print(f"Hello,{name} nice to meet you!") print("Hope you’re ready to become a CS Master! 💻🔥") user_name = input("what is your name?") welcome(user_name) ``` #### 📖note `def(container)` function: set up Reusable code block <font color="#66ccff">changable variant</font> to output different outcome ## 📓 What I Learned Today - How to use `print()`, `input()`, and basic variables in Python - The difference between `+` and `,` in print - How to get the **current year** using `datetime` - How to define and call a function - How to write cleaner code using **f-strings** ## 🔍 Questions or Confusions - Difference between `,` and `+` in print - When to use `int()` and why input is string ## 🧠 My Reflection Always double-check your spelling and grammar to ensure your code comments and explanations are clear and professional. ### 💡 Coding Tip of the Day > <font color="#66ccff"><b>When you're coding, it's better to write clearly and in detail than to rush through it. Break your code into sections instead of lumping everything together.</b></font> 🧠 Good code isn't just for machines to run — it's also for **humans to read** (including future you)! (📝 中文:當你在編程時,寫得詳細明白比急著寫完更重要。請記得把程式分段清楚,而不是擠成一團。)