By kovolff · 10/22/2020
Welcome to Baseline Pi! In this series, we will embark on a journey from zero to becoming proficient Python developers, focusing on building a unit converter web application together. Join us on this journey.
Python is a general-purpose programming language that allows you to create various applications, from web apps to data analysis systems. It is an interpreted language, which means it is slightly slower than compiled languages like C, but it offers rapid development capabilities. Learn more about Python.
To start coding in Python, download the latest version from python.org. You can use IDLE, Notepad++, or Visual Studio Code as your code editor. Explore your options.
Let's print our first conversion from kilometers to miles. The conversion factor is 0.621371. Here's how you can do it:
# km = 15
# conversion = 0.621371
print(15 * 0.621371)
This will output the distance in miles. See the first example.
In the first version of our unit converter, we will expand our code to convert kilometers to multiple units:
# km = 15
# conversion to miles = 0.621371
# conversion to yards = 1093.61
# conversion to feet = 3280.84
# conversion to nautical miles = 0.539957
print(15 * 0.621371) # km to miles conversion
print(15 * 1093.61) # km to yards conversion
print(15 * 3280.84) # km to feet conversion
print(15 * 0.539957) # km to nautical miles conversion
This will allow us to see various conversions at once. Check out the code.
As we progress, we will refine our application and learn more about Python programming. Stay tuned for the next video where we will simplify our code further! Don't miss it.
2/6/2025
1/3/2020
10/21/2020
3/13/2021
1/19/2025
9/26/2021