Welcome to the "Chapter" Introduction to 100 Days of Code with
Python Programming! In this chapter, we'll explore the fundamentals
of Python programming and embark on an exciting journey of coding
for the next 100 days. Let's dive into the world of Python, learning its
syntax, data structures, and problem-solving techniques, all while
building a solid foundation for your programming skills.
"Every expert was once a beginner." - Helen Hayes
Throughout this chapter, you'll find examples, hand-drawn plots,
quotes, and anecdotes that will make learning Python enjoyable and
engaging. By the end, you'll be able to write Python code, solve basic
problems, and understand the logic behind the programs you create.
But wait - why Python? 🐍
Python is a versatile, high-level language that's easy to learn and
powerful to use. It's suitable for beginners due to its readability and
simplified syntax and is widely used in the industry for web
development, machine learning, automation, data analysis, and more.
So, let's start by understanding Python's basic syntax!
Python code is organized in blocks, with indentation defining the
structure.
print("Hello, World!") # This is an example of a
single-line print statement.
, if 5 > 2: # An if-statement is a type of control
flow in Python.
print("Five is greater than two.") #
Indentation defines the code that runs when the
condition is True.
When executed, the above code will print:
Hello, World!
Five is greater than two.
Let's move on to Python's data types!
Python has several built-in data types:
● Integers (int): Whole numbers with no decimal points, e.g., 7,
-5, and 0.
● Floats (float): Numbers with decimal points, e.g., 7.5, 0.2, and
-0.1.
● Strings (str): Sequences of characters, enclosed in either
single or double quotes, e.g., "Python", 'Code', and "100 Days!".
● Booleans (bool): Logical values True and False.
Here's an example demonstrating these data types in Python:
integer_value = 42 # Integer data type.
float_value = 3.14 # Float data type.
string_value = "Python is fun!" # String data type.
boolean_value = True # Boolean data type.
print("Integer:", integer_value)
print("Float:", float_value)
print("String:", string_value)