KevsRobots Learning Platform
By Kevin McAleer, 4 Minutes

In this lesson, we’ll explore the basics of Python programming. This includes understanding variables, data types, basic syntax, comments, and operators.
Variables are containers that hold data. Python has various data types including:
10, 15, 22.1.5, 2.67, 3.14.True or False.'hello', 'Python'.Here’s how you can create variables of different types:
# An integer
age = 25
# A float
height = 5.6
# A boolean
is_adult = True
# A string
name = "Alice"
Python has a clean and easy-to-understand syntax. Here are some key points:
if age > 18:
print("You are an adult.")
\).total = 1 + 2 + 3 + \
4 + 5 + 6
Comments are essential in making your code understandable to others and your future self. They are lines that are not executed by the Python interpreter.
Python doesn’t have a true multi-line comment. A triple-quoted string that isn’t assigned to anything is ignored, so people often use one as a comment. You can also just start each line with #.
Python supports a variety of operators:
+, -, *, /, //, %, **==, !=, >, <, >=, <=print(x == y) # Equal to
print(x != y) # Not equal to
print(x > y) # Greater than
print(x < y) # Less than
print(x >= y) # Greater than or equal to
print(x <= y) # Less than or equal to
and, or, notQuick quiz 1 of 2
What is 7 // 2 in Python?
// is floor division: it divides and rounds down to a whole number. 7 % 2 would give the remainder, 1.Quick quiz 2 of 2
What data type is True?
True or False, with a capital letter.This lesson covered the basics of Python, including variables, data types, basic syntax, comments, and operators. These are foundational concepts that you’ll use in every Python program you write.
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments