Posts

Showing posts from January, 2025

Coding Lesson (27-31 January)

MONDAY Continue learning Python on Kaggle. Changing Lists Lists are "mutable". You can modify your lists "in place". For example, I want to change the name of the locker owner.  Well, Lkhagvasuren is a really hard name to type (I don't know why I choose that name at the first place). So, I'm going to change it. lockers[6] = 'Amogus' lockers ['Emily', 'John', 'Adam', 'Alicia', 'Eve', 'Zack', 'Amogus'] That's easier to read. We also can change two and more. Not just one. For example: lockers[:3] = ['Aidan', 'Raito', 'Yelena'] print(lockers) ['Aidan', 'Raito', 'Yelena', 'Alicia', 'Eve', 'Zack', 'Amogus'] List functions Python has several useful functions for working with lists, like len , sorted , sum , min and max .  Example for 'len': len(lockers) # Output: 7 Example for 'sorted': sorted(lockers) #...

Coding Lesson (20-24 January)

Image
Monday Continue on Grade Calculator Project. Today I will learn how to receive input in Python.  I tried making the code into an HTML but for unknown reason it's bugged. The line that should be inside the code appeared at the web browser. I tried so many things that can help me to get done the things with help of Copilot but unfortunately it doesn't work. Here's the picture of what happening: The calculate button also doesn't work. How unfortunate. Tuesday Continue learning to receive input in Python. Today, I will use another way. Instead of making it into an html, we're going to try using command prompt. Here's the code with the explanations: # Function to calculate the average of the grades def calculate_average(grades):     return sum(grades) / len(grades) # Function to determine the letter grade based on the average def determine_letter_grade(average):     if 90 <= average <= 100:  # A grade         return 'A'     el...

Coding Lesson (13-17 January)

Monday I learned about Getting Help  in Kaggle. The help() function is incredibly useful. It gives you detailed information about how to use a function and what it does. For example: help(print) shows you that print() can take several optional arguments like sep (which controls what gets printed between multiple values) and end  (which controls what gets printed at the end of the line). Also, there's a  COMMON MISTAKES TO AVOID:  Make sure you pass the function name itself to help() , not the result of calling the function. Tuesday I continue learning about Getting Help—defining functions—in Kaggle. Here's a simple function example: def say_hello():     print("Hello.") def is the keyword that tells Python you are defining a function and  say_hello  is the name of the function. So, when you call say_hello it will print "Hello.". But, how about functions that take inputs? Here's the example: def least_difference(a, b, c):     diff1 = abs...