0% found this document useful (0 votes)
80 views2 pages

Python Basics: Practice Questions Guide

The document contains a series of Python practice questions and solutions covering basic programming concepts. It includes tasks such as arithmetic operations, checking even/odd numbers, string manipulation, temperature conversion, and calculating simple interest. Each task is accompanied by sample code to demonstrate the implementation.

Uploaded by

lavanyavaranasi3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views2 pages

Python Basics: Practice Questions Guide

The document contains a series of Python practice questions and solutions covering basic programming concepts. It includes tasks such as arithmetic operations, checking even/odd numbers, string manipulation, temperature conversion, and calculating simple interest. Each task is accompanied by sample code to demonstrate the implementation.

Uploaded by

lavanyavaranasi3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Day 1 - Python Basics: Practice Questions & Solutions

1. Take 2 numbers as input and print their sum, difference, and product.
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))

print("Sum:", a + b)
print("Difference:", a - b)
print("Product:", a * b)

2. Check if a number is even or odd.


n = int(input("Enter a number: "))

if n % 2 == 0:
print("Even")
else:
print("Odd")

3. Take a string and print it in uppercase.


s = input("Enter a string: ")
print("Uppercase:", [Link]())

4. Convert Celsius to Fahrenheit.


celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print("Temperature in Fahrenheit:", fahrenheit)

5. Print the multiplication table of a given number.


n = int(input("Enter a number: "))

for i in range(1, 11):


print(f"{n} x {i} = {n*i}")

6. Check if a number is positive, negative, or zero.


num = int(input("Enter a number: "))

if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")

7. Calculate Simple Interest.


p = float(input("Enter principal: "))
r = float(input("Enter rate of interest: "))
t = float(input("Enter time (in years): "))

si = (p * r * t) / 100
print("Simple Interest:", si)

8. Take a 3-digit number and print the sum of its digits.


n = int(input("Enter a 3-digit number: "))

digit1 = n // 100
digit2 = (n // 10) % 10
digit3 = n % 10

sum_digits = digit1 + digit2 + digit3


print("Sum of digits:", sum_digits)

9. Check if a number is a multiple of both 3 and 5.


n = int(input("Enter a number: "))

if n % 3 == 0 and n % 5 == 0:
print("Multiple of both 3 and 5")
else:
print("Not a multiple of both")

10. Take 3 numbers and find the maximum.


a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))

maximum = max(a, b, c)
print("Maximum number is:", maximum)

You might also like