Module 1 of Python Basics by A K Singh
Module 1 of Python Basics by A K Singh
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.
Once you have Python and your chosen IDE installed, you're ready
to write your first Python program!
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.
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:
# 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 != ""
Python programs can interact with the user by taking input and
displaying output. Here's how to achieve this: