|
S.No |
Task |
One-Line
Python Code |
|
1 |
Print
Hello World |
print("Hello,
World!") |
|
2 |
Print
Your Name |
print("My
name is Maddy") |
|
3 |
Add
Two Numbers |
print(10
+ 20) |
|
4 |
Multiply
Two Numbers |
print(5
* 8) |
|
5 |
Find
Square of a Number |
print(7
** 2) |
|
6 |
Find
Cube of a Number |
print(4
** 3) |
|
7 |
Divide
Two Numbers |
print(20
/ 5) |
|
8 |
Find
Remainder |
print(17
% 3) |
|
9 |
Print
Current Year |
print(2026) |
|
10 |
Print
a Welcome Message |
print("Welcome
to Python Programming") |
|
11 |
Take
Input and Print It |
print(input("Enter
your name: ")) |
|
12 |
Print
the Data Type |
print(type(100)) |
|
13 |
Convert
String to Integer |
print(int("50")) |
|
14 |
Convert
Integer to Float |
print(float(25)) |
|
15 |
Find
Maximum Number |
print(max(5,
9, 3, 12)) |
|
16 |
Find
Minimum Number |
print(min(5,
9, 3, 12)) |
|
17 |
Find
Absolute Value |
print(abs(-25)) |
|
18 |
Generate
a Random Number |
from
random import randint; print(randint(1,10)) |
|
19 |
Print
the Length of a String |
print(len("Python")) |
|
20 |
Print
Today's Motivation |
print("Believe
in yourself. Happy Coding!") |
Question 1: Hello Python
print("Hello") print("Python")
Predict the Output:
Question 2: Addition
a = 10 b = 20 print(a + b)
Predict the Output:
Question 3: Multiplication
x = 5 print(x * 4)
Predict the Output:
Question 4: String Repetition
print("Hi" * 3)
Predict the Output:
Question 5: Variable Update
num = 8 num = num + 2 print(num)
Predict the Output:
Question 6: Integer Division
print(15 // 2)
Predict the Output:
Question 7: Modulus Operator
print(15 % 4)
Predict the Output:
Question 8: Comparison Operator
a = 10 b = 20 print(a < b)
Predict the Output:
Question 9: Simple If Statement
x = 7 if x > 5: print("Python") print("Programming")
Predict the Output:
Question 10: String Concatenation
name = "Alice" print("Hello " + name)
Predict the Output:
Question 11: Addition and Multiplication
a = 2 b = 3 print(a + b * 2)
Predict the Output: ______________________
Question 12: String with Number
age = 18 print("Age =", age)
Predict the Output: ______________________
Question 13: String Concatenation
first = "Data" second = "Science" print(first + second)
Predict the Output: ______________________
Question 14: Exponent Operator
print(2 ** 3)
Predict the Output: ______________________
Question 15: Floating-Point Division
print(9 / 2)
Predict the Output: ______________________
Question 16: Equality Comparison
x = 10 y = 10 print(x == y)
Predict the Output: ______________________
Question 17: Logical Operator
print(True and False)
Predict the Output: ______________________
Question 18: Simple If-Else
marks = 45 if marks >= 50: print("Pass") else: print("Fail")
Predict the Output: ______________________
Question 19: Variable Swapping
a = 5 b = 8 a = b print(a)
Predict the Output: ______________________
Question 20: Mixed Arithmetic
x = 6 y = 4 print((x + y) * 2)
Predict the Output: ______________________
S.No | Program | Concepts Covered |
1 | Print "Hello, World!" | print() function |
2 | Read and Print User Details (Name, Age, Branch) | input(), variables |
3 | Add Two Numbers | Variables, arithmetic operators |
4 | Find the Area of a Rectangle | Input, multiplication |
5 | Convert Temperature (Celsius to Fahrenheit) | Formula, arithmetic |
6 | Check Whether a Number is Even or Odd | if-else, modulus operator |
7 | Find the Largest of Two Numbers | Conditional statements |
8 | Print Multiplication Table of a Number | for loop |
9 | Calculate the Sum of Numbers from 1 to N | Loops, accumulator |
10 | Simple Calculator (+, -, *, /) | if-elif-else, operators |
1. Hello
World
print("Hello,
World!")
Sample Output
Hello,
World!
2. Read and
Print User Details
name
= input("Enter your name: ")
age
= input("Enter your age: ")
branch
= input("Enter your branch: ")
print("Name:",
name)
print("Age:",
age)
print("Branch:",
branch)
Sample Output
Enter
your name: Ravi
Enter
your age: 19
Enter
your branch: CSE
Name:
Ravi
Age:
19
Branch:
CSE
3. Addition
of Two Numbers
a
= int(input("Enter first number: "))
b
= int(input("Enter second number: "))
sum
= a + b
print("Sum
=", sum)
Sample Output
Enter
first number: 15
Enter
second number: 20
Sum
= 35
4. Area of a
Rectangle
length
= float(input("Enter length: "))
breadth
= float(input("Enter breadth: "))
area
= length * breadth
print("Area
=", area)
Sample Output
Enter
length: 8
Enter
breadth: 5
Area
= 40
5. Celsius
to Fahrenheit
celsius
= float(input("Enter temperature in Celsius: "))
fahrenheit
= (celsius * 9/5) + 32
print("Temperature
in Fahrenheit =", fahrenheit)
Sample Output
Enter
temperature in Celsius: 30
Temperature
in Fahrenheit = 86.0
6. Even or
Odd
num
= int(input("Enter a number: "))
if
num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
Sample Output
Enter
a number: 27
Odd
Number
7. Largest
of Two Numbers
a
= int(input("Enter first number: "))
b
= int(input("Enter second number: "))
if
a > b:
print("Largest =", a)
else:
print("Largest =", b)
Sample Output
Enter
first number: 25
Enter
second number: 18
Largest
= 25
8.
Multiplication Table
num
= int(input("Enter a number: "))
for
i in range(1, 11):
print(num, "x", i, "=",
num * i)
Sample Output
5
x 1 = 5
5
x 2 = 10
...
5
x 10 = 50
9. Sum of
Numbers from 1 to N
n
= int(input("Enter a number: "))
sum
= 0
for
i in range(1, n + 1):
sum += i
print("Sum
=", sum)
Sample Output
Enter
a number: 10
Sum
= 55
10. Simple
Calculator
a
= float(input("Enter first number: "))
b
= float(input("Enter second number: "))
op
= input("Enter operator (+, -, *, /): ")
if
op == "+":
print("Result =", a + b)
elif
op == "-":
print("Result =", a - b)
elif
op == "*":
print("Result =", a * b)
elif
op == "/":
if b != 0:
print("Result =", a / b)
else:
print("Division by zero is not
allowed.")
else:
print("Invalid Operator")
Sample Output
Enter
first number: 20
Enter
second number: 4
Enter
operator (+, -, *, /): /
Result
= 5.0