Python for Beginners - Learn Python in 1 Hour
Programming with Mosh
Python Programming Tutorial
In this Python tutorial, you'll learn everything you need to
start programming in Python. This tutorial is perfect for data
science, machine learning, and web development. No prior
knowledge in Python or programming is required as everything will
be taught from scratch. I'm Mosh Hamadani, and I've taught
millions of people how to code through this channel. If you're
new here, make sure to subscribe as I upload new videos every
week. Let's jump in and get started.
What is Python?
Python is a multipurpose programming language that can be used
for a variety of different tasks, such as automation, web
development, and data science.
You need to install a code editor to write your own
Python code.
Numbers - This includes integers and floating-point
numbers.
Booleans - This includes True and False values.
Converting Data Types in Python
Python has several built-in functions for converting the types of
our variables. For example, we have the int() function for
converting a value to an integer:
birth_year = "1982"age = 2020 - int(birth_year)print("You are " +
str(age) + " years old.")
In the above example, we use the int() function to convert the
birth_year string to an integer so we can subtract it from the
current year.
We also have the float() function for converting a value to a
float:
num = "10.5"float_num = float(num)print(float_num)
In the above example, we use the float() function to convert the
num string to a floating point number.
Programming with Mosh
Python Programming Tutorial
In this Python tutorial, you'll learn everything you need to
start programming in Python. This tutorial is perfect for data
science, machine learning, and web development. No prior
knowledge in Python or programming is required as everything will
be taught from scratch. I'm Mosh Hamadani, and I've taught
millions of people how to code through this channel. If you're
new here, make sure to subscribe as I upload new videos every
week. Let's jump in and get started.
What is Python?
Python is a multipurpose programming language that can be used
for a variety of different tasks, such as automation, web
development, and data science.
You need to install a code editor to write your own
Python code.
Numbers - This includes integers and floating-point
numbers.
Booleans - This includes True and False values.
Converting Data Types in Python
Python has several built-in functions for converting the types of
our variables. For example, we have the int() function for
converting a value to an integer:
birth_year = "1982"age = 2020 - int(birth_year)print("You are " +
str(age) + " years old.")
In the above example, we use the int() function to convert the
birth_year string to an integer so we can subtract it from the
current year.
We also have the float() function for converting a value to a
float:
num = "10.5"float_num = float(num)print(float_num)
In the above example, we use the float() function to convert the
num string to a floating point number.