A1

Sat 18 April 2026
# A basic Python program
print("Hello, World!")
Hello, World!
# Simple addition program
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
sum = a + b
print("The sum is:", sum)
Enter first number:  6
Enter second number:  4


The sum is: 10
name = input("Enter your name: ")
print("Hello,", name)
Enter your name:  4


Hello, 4


Score: 0

Category: a1.py


A10

Sat 18 April 2026
p, r, t = 1000, 5, 2
ci = p * (1 + r/100)**t
print("Compound Interest:", ci)
Compound Interest: 1102.5
c = 37
f = (c * 9/5) + 32
print("Fahrenheit:", f)
Fahrenheit: 98.6
def fact(n):
    return 1 if n==0 else n*fact(n-1)
print("Factorial:", fact(5 …

Category: a1.py

Read More

A11

Sat 18 April 2026
n = 10
print("Sum:", sum(range(1, n+1)))
Sum: 55
for i in range(1, 20, 2):
    print(i, end=" ")
1 3 5 7 9 11 13 15 17 19
for i in range(2, 21, 2):
    print(i, end=" ")
2 4 6 8 10 12 14 16 18 …

Category: a1.py

Read More

A12

Sat 18 April 2026
a, b, c = 15, 25, 10
print("Largest:", max(a, b, c))
Largest: 25
a, b, c = 15, 25, 10
print("Smallest:", min(a, b, c))
Smallest: 10
nums = [2, 4, 6, 8]
print("Sum:", sum(nums))
Sum: 20


Score: 0

Category: a1.py

Read More

A13

Sat 18 April 2026
nums = [10, 20, 30, 40]
print("Average:", sum(nums)/len(nums))
Average: 25.0
nums = [1, 2, 2, 3, 4, 4]
print("Unique:", list(set(nums)))
Unique: [1, 2, 3, 4]
nums = [5, 2, 9, 1]
nums.sort()
print("Sorted:", nums)
Sorted: [1, 2, 5, 9]


Score: 0

Category: a1.py

Read More

A14

Sat 18 April 2026
t = (1, 2, 3)
print("Tuple:", t)
Tuple: (1, 2, 3)
s = {1, 2, 3, 2}
print("Set:", s)
Set: {1, 2, 3}
with open("test.txt", "w") as f:
    f.write("Hello File!")


Score: 0

Category: a1.py

Read More

A15

Sat 18 April 2026
with open("test.txt", "w") as f:
    f.write("Hello File!")
with open("test.txt", "r") as f:
    print(f.read())
Hello File!
class Student:
    def __init__(self, name):
        self.name = name

s = Student("Alice")
print("Student name:", s.name)
Student name: Alice


Score: 0

Category: a1.py

Read More

A16

Sat 18 April 2026
try:
    x = int("abc")
except ValueError:
    print("Invalid conversion!")
Invalid conversion!
import random
print("Random:", random.randint(1, 100))
Random: 66
import math
print("Square root of 16:", math.sqrt(16))
Square root of 16: 4.0


Score: 0

Category: a1.py

Read More

A17

Sat 18 April 2026
print("2 raised to 5:", pow(2, 5))
2 raised to 5: 32
num = -25
print("Absolute:", abs(num))
Absolute: 25
text = "Python"
print("Length:", len(text))
Length: 6


Score: 0

Category: a1.py

Read More
Page 1 of 3

Next »