Beginners Guide to Python: Day 1 Learning and Exploring IPython

Python JSPython JS
5 min read

Hey there, future Pythonista! ๐Ÿ

Welcome to the world of Python programming! If you've ever wanted to learn how to code but didn't know where to start, you're in the right place. Python is one of the easiest, most powerful, and widely used programming languages out there, and today, we're taking our first step together.

By the end of this lesson, youโ€™ll:
โœ… Understand what Python is and why it's awesome.
โœ… Set up your Python environment with IPython.
โœ… Write your first Python program.
โœ… Explore basic Python concepts like variables and math operations.

Letโ€™s dive in and make learning Python fun! ๐ŸŽ‰


๐Ÿ What is Python, and Why Should You Care?

Python is a high-level, beginner-friendly programming language used for web development, data science, automation, AI, and more. Hereโ€™s why millions of developers love Python:

โœ”๏ธ Simple & Readable โ€“ The syntax is close to English!
โœ”๏ธ Versatile โ€“ You can build websites, analyze data, or even automate tasks.
โœ”๏ธ Huge Community โ€“ Tons of resources and support.
โœ”๏ธ Powerful Libraries โ€“ Pre-built tools for almost everything!

It was created by Guido van Rossum in 1991 and has since become one of the most popular languages in the world. Whether you want to become a software engineer, a data scientist, or an automation wizard, Python is the perfect starting point.


๐Ÿ› ๏ธ Setting Up Python and IPython (The Fun Way!)

To write and run Python code, we need a coding environment. Instead of using the boring default Python shell, we'll use IPython, which makes coding faster, smarter, and more fun!

Step 1: Check if Python is Installed

Open your terminal (Command Prompt on Windows, Terminal on macOS/Linux) and type:

python --version

or

python3 --version

If Python is not installed, download and install it from Python.org.

Step 2: Install IPython

Once Python is installed, open your terminal and type:

pip install ipython

Step 3: Launch IPython

After installation, start IPython by running:

ipython

Now, you should see a fancy Python prompt like this:

In [1]:

You're now inside IPython, an interactive Python shell where you can write, test, and run code dynamically! ๐Ÿš€


๐Ÿ‘จโ€๐Ÿ’ป Writing Your First Python Program

Time to write some actual code! Open IPython and type:

print("Hello, Python World!")

Press Enter, and you should see:

Hello, Python World!

๐ŸŽ‰ Congratulations! You just wrote your first Python program! ๐ŸŽ‰

๐Ÿ’ก What Just Happened?

  • The print() function displays text on the screen.
  • "Hello, Python World!" is a string (text data in Python).

Thatโ€™s it! Youโ€™re already coding in Python. ๐Ÿ”ฅ


๐Ÿ“Œ Playing with Variables in IPython

Python lets you store information in variables so you can use it later. Try this in IPython:

name = "Alice"  # A string
age = 25        # An integer
height = 5.6    # A float (decimal number)
is_student = True  # A boolean (True/False)

Now, type the variable name and hit Enter to see its value:

name

Output:

'Alice'

You can also check what type of data is stored in a variable:

type(age)

Output:

<class 'int'>

โœ” Integers (int) store whole numbers.
โœ” Floats (float) store decimal numbers.
โœ” Strings (str) store text.
โœ” Booleans (bool) store True or False.


โž— Doing Math in Python (Like a Calculator!)

Python can handle basic arithmetic like a calculator. Try this:

5 + 3   # Addition
10 - 2  # Subtraction
4 * 3   # Multiplication
8 / 2   # Division
10 % 3  # Modulus (Remainder)

Want to store results?

result = 10 * 5
print(result)

Output:

50

โœ” Python remembers your calculations so you can use them later!


๐Ÿš€ Why IPython is Awesome

IPython is not just any Python shellโ€”it has superpowers! ๐Ÿฆธ

โœ… Auto-completion โ€“ Press Tab to complete commands.
โœ… Syntax Highlighting โ€“ Makes your code more readable.
โœ… Magic Commands โ€“ Special shortcuts to speed up your work.

โณ Measure Execution Time in IPython

Ever wondered how fast your code runs? Try this:

%timeit sum(range(1000))

This tells you how long it takes to execute the operation. Super useful! ๐Ÿš€


๐ŸŽฏ Homework: Practice & Explore

To make sure you really understand today's lesson, try these exercises in IPython:

1๏ธโƒฃ Assign your name, age, and favorite food to variables.
2๏ธโƒฃ Perform basic math and store the results in a variable.
3๏ธโƒฃ Use the type() function to check the data types of different variables.
4๏ธโƒฃ Take user input and print a greeting:

name = input("Enter your name: ")
print("Hello,", name)

๐Ÿ“Œ Pro Tip: Experiment and try new things in IPythonโ€”itโ€™s a great way to learn!


๐Ÿ”œ Whatโ€™s Coming Next?

Now that youโ€™ve written your first Python program, itโ€™s time to level up! In the next lesson, weโ€™ll dive into:

โœ… Lists, Tuples, and Dictionaries (Powerful ways to store data)
โœ… Loops and Conditional Statements (Making Python programs smarter)

Stay tunedโ€”this is just the beginning! ๐Ÿš€


๐Ÿ™Œ Final Thoughts: You Did It!

Youโ€™ve officially taken your first step into Python programming! Whether you want to build websites, analyze data, or automate tasks, Python is your gateway to endless possibilities.

๐Ÿš€ Keep practicing, stay curious, and have fun!

๐Ÿ‘‰ If this lesson helped you, share it with a friend who wants to learn Python!
๐Ÿ”” Subscribe to get the next lesson straight to your inbox!


๐Ÿ’ก Got any questions? Drop them in the commentsโ€”Iโ€™d love to help! ๐Ÿ˜Š

0
Subscribe to my newsletter

Read articles from Python JS directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Python JS
Python JS

๐Ÿ‘‹ Hey, I'm Ajay Kumar Joshi โ€“ a Python & JavaScript enthusiast passionate about breaking down complex programming concepts into simple, digestible lessons. I created PythonJS to help developers, students, and professionals learn Python and JavaScript the easy wayโ€”through byte-sized lessons, real-world examples, and a structured approach to coding. ๐Ÿš€ Follow along as I simplify tough topics, share coding insights, and build a community of lifelong learners. ๐Ÿ”— Explore more at pythonjs.org