SIMPLE & COMPLETE PYTHON STUDY GUIDE
Class 10: Python Basics & Core Programs
Part 1: Core Python Theory
1. Keywords, Identifiers, Variables, and Naming Rules
• Keywords: Special reserved words in Python that have a fixed, pre-defined meaning. You can never use
them as variable names.
Examples: if, else, True, print.
• Identifiers: The unique names given by a programmer to variables, functions, or classes to define and
identify them clearly within a program.
• Variables: A named memory storage container used to hold data values that can change during program
execution. Think of it as a labeled box.
Naming Rules for Variables:
1. Must start only with a letter (a-z, A-Z) or an underscore (_).
2. Cannot start with a number (e.g., 1num is invalid, but num1 is perfectly valid).
3. Can only contain alphanumeric characters and underscores (A-z, 0-9, and _). No blank spaces or
special punctuation characters (like $, @, !) are allowed.
4. Python is strictly case-sensitive (meaning Age and age are treated as two entirely different variables).
2. Type Casting
Definition: Type casting is the process of manually converting a data value from one data type into another
data type by using Python's built-in conversion functions.
• int() function: Converts a given text number or decimal into a clean whole integer. E.g., int("5")
outputs the integer 5.
• str() function: Converts any number value into a plain string text format. E.g., str(10) outputs the text
string "10".
Class 10 — Python Complete Theory & Programs Study Guide Page 1
3. Comments in Python
Definition: Comments are plain text notes written inside the program code strictly for human understanding.
Python completely skips and ignores them when running code blocks.
• Single-line comment: Starts with a hash symbol (#) and applies to only that single line.
• Multi-line comment: Used for long explanations that stretch across several lines. Written by wrapping
text within triple quotation marks.
4. Core Data Types
Definition: Data types represent the category of data that a variable can hold, letting Python know what
type of operations can be safely performed on that specific value.
• Integer (int): Represents positive or negative whole numbers that do not contain any fractions or decimal
components. E.g., 12, -4, 0.
• String (str): Represents a sequence of text characters wrapped securely inside single or double
quotation marks. E.g., "Hello World", 'Python'.
• Boolean (bool): Represents a basic logical state that can evaluate to only one of two built-in values:
True or False.
5. Mathematical & Logical Operators
Definition: Operators are special symbols or tokens that tell Python to perform specific mathematical
calculations, logic comparisons, or value manipulations.
• Arithmetic Operators (For Math Calculations): Used to perform basic calculations. Includes +
(Addition), - (Subtraction), * (Multiplication), / (Standard Division), and % (Modulus / Remainder
tracking).
• Comparison Operators (Gives True or False): Used to compare two operands. Includes == (Equal
to), != (Not equal to), > (Greater than), and < (Less than).
• Logical Operators (Combining Multiple Conditions): Used to build complex logic paths. Includes and
(Returns True if both separate conditions are True), or (Returns True if at least one condition evaluates to
True), and not (Inverts the final True/False choice state).
Class 10 — Python Complete Theory & Programs Study Guide Page 2
Part 2: Core Python Practice Programs
Program 1: Greatest of Two Numbers
num1 = int(input("Enter first number "))
num2 = int(input("Enter second number "))
if num1 > num2:
print("Greatest number is", num1)
elif num2 > num1:
print("Greatest number is", num2)
else:
print("Both numbers are equal")
Program 2: Greatest of Three Numbers
a = int(input("Enter first number "))
b = int(input("Enter second number "))
c = int(input("Enter third number "))
if a >= b and a >= c:
print("Greatest number is", a)
elif b >= a and b >= c:
print("Greatest number is", b)
else:
print("Greatest number is", c)
Program 3: Checking Even or Odd
num = int(input("Enter a number "))
if num % 2 == 0:
print(num, "is an Even number")
else:
print(num, "is an Odd number")
Class 10 — Python Complete Theory & Programs Study Guide Page 3
Program 4: Swapping Two Variables
x = input("Enter value of x ")
y = input("Enter value of y ")
temp = x
x = y
y = temp
print("After swapping")
print("x =", x)
print("y =", y)
Program 5: Finding the Area of Geometric Shapes
r = int(input("Enter radius "))
area = 3.14 * r * r
print("Area of Circle is", area)
s = int(input("Enter side "))
area = s * s
print("Area of Square is", area)
base = int(input("Enter base "))
height = int(input("Enter height "))
area = (base * height) / 2
print("Area of Triangle is", area)
l = int(input("Enter length "))
w = int(input("Enter width "))
area = l * w
print("Area of Rectangle is", area)
Class 10 — Python Complete Theory & Programs Study Guide Page 4
Program 6: Finding Perimeter & Circumference
r = int(input("Enter radius "))
circumference = 2 * 3.14 * r
print("Circumference of Circle is", circumference)
s = int(input("Enter side "))
perimeter = 4 * s
print("Perimeter of Square is", perimeter)
l = int(input("Enter length "))
w = int(input("Enter width "))
perimeter = 2 * (l + w)
print("Perimeter of Rectangle is", perimeter)
Class 10 — Python Complete Theory & Programs Study Guide Page 5