Python Class 8
Python Class 8
print("Hello, World!")
x=5 # integer
y = 3.14 # float
Arithmetic Operators:
Python supports arithmetic operations like addition, subtraction, multiplication, and division.
a = 10
b=5
sum = a + b
difference = a - b
product = a * b
quotient = a / b
modulus = a%b
power = a**b
Conditional Statements:
age = 12
else:
Loops:
for i in range(5):
print(i)
print(x)
x += 1
Indentation:
Python uses indentation to define code blocks, like loops and in conditional statements,
1- WAP AREA OF RECTANGLE
CODE OUTPUT
CODE OUTPUT
23- WAP SUM OF NTH NO.
CODE OUTPUT