0
0

Brushing Up Fundamentals

Today’s lesson was a good review of fundamental Python skills. Concepts such as math operations and data types were revisited, strengthening my foundational knowledge.

New Concepts

Round Function: I delved into the versatility of the round() function, learning to manipulate precision effortlessly.

print(round(8/3))  # Rounded division result
print(round(8/3, 2))  # Rounded to two decimal places
Python

Exponents and Floor Division: Embracing the power of exponents (**) and the simplicity of floor division (//) broadened my understanding of mathematical operations.

print(2**3)  # Exponentiation
print(8//3)  # Floor division
Python

Exploring Data Manipulation Techniques

One of the intriguing topics covered was subscripting to isolate specific characters within strings, opening up new possibilities for data manipulation.

Practical Applications: Building Tools in Python

BMI Calculator

Building a BMI calculator provided an opportunity to convert string inputs into integers efficiently, enhancing my skills in data processing.

# 1st input: enter height in meters e.g: 1.65
height = input("what is your height in meters?" )
# 2nd input: enter weight in kilograms e.g: 72
weight = input("What is your weight in kilograms" )
# 🚨 Don't change the code above 👆

# Write your code below this line 👇
answer=(float(weight)/float(height)**2)
final_answer=int(answer)
print(final_answer)

Python

Tip Calculator Refinement

Revisiting a familiar project, the tip calculator, allowed me to implement newfound concepts like the format() function for more polished outputs.

bill = float(input("How much was your bill today? "))
people = int(input("How many people would you like to split the bill between? "))
tip = int(input("What percentage of tip would you like to leave? "))

tip_percent = tip / 100
tip_total = (bill / people * tip_percent)
total = tip_total + bill
final_total = round(total, 2)
print(f"Each person should be paying ${total:.2f}")
Python

Conclusion: Growth and Progress

Day two of the 100 days of code challenge has been enriching, reinforcing my understanding of core concepts while empowering me to build useful applications. I look forward to further challenges and discoveries that lie ahead!

This error message is only visible to WordPress admins

Error: No feed found.

Please go to the Instagram Feed settings page to create a feed.