|
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!") |
|
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