0% found this document useful (0 votes)
34 views

Module 1 of Python Basics by A K Singh

Module 1 Of Python Basics by A K Singh

Uploaded by

schoolhelpmentor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Module 1 of Python Basics by A K Singh

Module 1 Of Python Basics by A K Singh

Uploaded by

schoolhelpmentor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

c.

Working with Missing Data


2. Quizzes:
a. Coding exercises to create DataFrames, select specific
data, and handle missing values.
b. MCQ quizzes on DataFrame functionalities and data
cleaning techniques.

Module 6: Basic Data Visualization with Matplotlib


1. Subtopics:
a. Creating Basic Plots (Line, Bar, Scatter)
b. Customizing Plots (Labels, Titles, Colors)
2. Quizzes:
a. Code challenges to create different types of plots
using Matplotlib functions.
b. Short quizzes on plot customization options.

Module 7: Putting it all Together - Mini-Project

This module will guide students through a mini-project applying


the learned concepts to analyze a real-world dataset (e.g., movie
ratings, weather data). Students will practice data cleaning,
manipulation, and visualization with NumPy, Pandas, and
Matplotlib.
Module 1: Introduction to Python
1. Subtopics:
a. Setting Up Python Environment (Installing Python and
IDE)
b. Variables and Data Types (Numbers, Strings, Booleans)
c. Operators (Arithmetic, Comparison, Logical)
d. Input and Output

2. Quizzes:
a. Multiple-choice quizzes to test understanding of data
types and operators.
b. Short coding exercises to practice writing simple
programs for calculations and user input.

Module 1: Introduction to Python

This module dives into the exciting world of Python programming!


We'll set up your development environment, explore fundamental
building blocks like variables and data types, and learn how to
perform calculations and interact with users through your Python
programs.

1.a. Setting Up Python Environment (Installing Python and IDE)


Before we start coding, we need to prepare our workspace. Here's
what you'll need:

 Python Interpreter: Download and install the latest version


of Python from the official website
https://www.python.org/downloads/. The installation process
is straightforward and provides clear instructions for
different operating systems (Windows, macOS, Linux).

 Integrated Development Environment (IDE): An IDE is a software


application that provides a user-friendly interface for
writing, running, and debugging Python code. Here are some
popular options (all free and beginner-friendly):
o Visual Studio Code: A versatile and customizable IDE with
excellent Python support.
https://code.visualstudio.com/
o PyCharm: A powerful IDE specifically designed for Python
development. https://www.jetbrains.com/pycharm/
o Thonny: A beginner-oriented IDE with a simple interface,
well-suited for learning the ropes. https://thonny.org/

Once you have Python and your chosen IDE installed, you're ready
to write your first Python program!

1.b. Variables and Data Types (Numbers, Strings, Booleans)


In Python, variables act like containers that store information you
can use throughout your program. They have names you choose and
data types that specify the kind of information they can hold. Here
are the fundamental data types we'll encounter:

 Numbers: Represent numeric values, including integers (whole


numbers) and floating-point numbers (decimals).
o Examples: age = 25, pi = 3.14159
 Strings: Represent sequences of characters, often used for
text. Strings are enclosed in single (') or double (") quotes.
o Examples: name = 'Alice', message = "Hello, world!"
 Booleans: Represent logical values, either True or False. They
are often used in conditional statements to make decisions
within your program.
o Examples: is_sunny = True, is_loggedin = False

Assigning values to variables uses the assignment operator (=). For


example:

Python Code :
age = 30
message = "Welcome!"
Tip: It's good practice to choose descriptive variable names that
reflect their purpose in the code. This makes your programs easier
to read and understand.

1.c. Operators (Arithmetic, Comparison, Logical)


Operators are special symbols used to perform calculations,
comparisons, and logical operations on data. Here are some common
operators in Python:

Arithmetic Operators:

 +: Addition
 -: Subtraction
 *: Multiplication
 /: Division (be aware of integer division vs. floating-point
division)
 //: Integer division (always results in an integer)
 %: Modulo (remainder after division)
 **: Exponentiation (raising a number to a power)

Comparison Operators:

 ==: Equal to
 !=: Not equal to
 >: Greater than
 <: Less than
 >=: Greater than or equal to
 <=: Less than or equal to

Logical Operators:

 and: True if both conditions are True


 or: True if at least one condition is True
 not: Inverts the truth value (e.g., not True is False)
Examples:

# Arithmetic
result = 10 + 5
age_in_days = age * 365

# Comparison
is_equal = age == 30
is_greater = 10 > 5

# Logical
is_adult = age >= 18
is_valid = username != "" and password != ""

1.d. Input and Output

Python programs can interact with the user by taking input and
displaying output. Here's how to achieve this:

Input: The input() function allows you to receive user input as a


string.

name = input("What is your name? ")


age = int(input("Enter your age: ")) # Convert input to an
integer using int()

Output: The print() function displays messages or variables on


the console.

You might also like