0% found this document useful (0 votes)
2 views

Practical Answers

The document contains a series of Python code snippets that perform various tasks such as printing names and numbers, basic arithmetic operations, determining even or odd numbers, calculating areas and perimeters of shapes, and checking eligibility for voting and driving based on age. Additionally, it includes conversions between kilometers and miles, as well as Celsius to Fahrenheit temperature conversion. Each code snippet prompts the user for input and displays the corresponding output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Practical Answers

The document contains a series of Python code snippets that perform various tasks such as printing names and numbers, basic arithmetic operations, determining even or odd numbers, calculating areas and perimeters of shapes, and checking eligibility for voting and driving based on age. Additionally, it includes conversions between kilometers and miles, as well as Celsius to Fahrenheit temperature conversion. Each code snippet prompts the user for input and displays the corresponding output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

# 1.

print("Atharv Atul Lahariya")

#2.
print(15)

#3.
print("My name is Atharv Atul Lahariya and I am 15 years old")

#4.
a = int(input('Enter number 1'))
b = int(input('Enter number 2'))
print(a+b)

#5.
a = int(input('Enter number 1'))
b = int(input('Enter number 2'))
print(a-b)

#6.
a = int(input('Enter number 1'))
b = int(input('Enter number 2'))
print(a*b)

#7
a = int(input('Enter number 1'))
b = int(input('Enter number 2'))
print(a/b)

#8.
num = int(input('Enter a number'))
if num % 2 == 0:
print('Even')
else:
print('Odd')

#9.
num = int(input('Enter a number'))
if num > 0:
print('Positive')
elif num < 0:
print('Negative')
else:
print('Zero')

#10.
length = int(input('Enter the length of the rectangle'))
width = int(input('Enter the width of the rectangle'))
area = length * width
print('Area of the rectangle:', area)

#11.
length = int(input('Enter the length of the rectangle'))
width = int(input('Enter the width of the rectangle'))
perimeter = 2 * (length + width)
print('Perimeter of the rectangle:', perimeter)
#12.
side = int(input('Enter the side of the square'))
perimeter = 4 * side
print('Perimeter of the square:', perimeter)

#13.
side = int(input('Enter the side of the square'))
area = side * side
print('Area of the square:', area)

#15.
principal = int(input('Enter the principal amount'))
rate = int(input('Enter the rate of interest'))
time = int(input('Enter the time period'))
interest = (principal * rate * time) / 100
print('Simple Interest:', interest)

#16.
base = int(input('Enter the base of the triangle'))
height = int(input('Enter the height of the triangle'))
area = 0.5 * base * height
print('Area of the triangle:', area)

#18.
age = int(input('Enter your age'))
if age >= 18:
print('Eligible to Vote')
else:
print('Not Eligible to Vote')

#19.
age = int(input('Enter your age'))
if age >= 18:
print('Eligible to Drive')
else:
print('Not Eligible to Drive')

#20.
kilometers = float(input('Enter the value in kilometers'))
miles = kilometers * 0.62
print('Miles:', miles)

#21.
celsius = float(input('Enter the temperature in Celsius'))
fahrenheit = (celsius * 9/5) + 32
print('Fahrenheit:', fahrenheit)

You might also like