Photo by Bench Accounting on Unsplash
Day One: Mastering Python: My Journey from Beginner to Certified Programmer in a Day
Learn: Basic Python String and Integer Operations
Today, I embarked on my journey to learn Python programming. Remarkably, within just one day, I completed the Intro to Programming section and earned my first certificate from Kaggle. Curious about how I achieved this? Let me explain. I've been interested in programming since 9th grade and already had some foundational knowledge. That's it!
Here are my learnings from today. Feel free to suggest anything that pops in your mind.
To round to the nearest integer, we import math
and use math.ceil()
.
To round to a specific number of decimal places, we use the round()
function. For example, to round to 5 decimal places: rounded_pi = round(almost_pi, 5)
print("Raushan" * True) # returns the same string
print("Raushan" * False) # returns an empty string with length 0
Output:
Raushan
When you add booleans, adding False is the same as adding 0, and adding True is the same as adding 1. If a list contains only True and False values, you can use the sum function to count the number of True values, as True is treated as 1. The second argument of round(firstarg, secArg) can be negative. Think about why this is. For example, if it is -2, it rounds to the nearest hundred, like 445 to 400 and 455 to 500.
Here is the link of my certificate: https://t.co/rXyCRMwocN