0% found this document useful (0 votes)
42 views13 pages

Data Handling

The document contains 25 questions that prompt the user for input and perform various calculations. These include calculating simple interest, average temperature, exponents, time conversions, number reversals, geometry formulas, and compound interest. The questions utilize basic math operators, input/output functions, and import math and random modules to perform the calculations.

Uploaded by

Aditi Tiwari
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)
42 views13 pages

Data Handling

The document contains 25 questions that prompt the user for input and perform various calculations. These include calculating simple interest, average temperature, exponents, time conversions, number reversals, geometry formulas, and compound interest. The questions utilize basic math operators, input/output functions, and import math and random modules to perform the calculations.

Uploaded by

Aditi Tiwari
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/ 13

#Q1

p = float(input("Enter principal: "))

r = float(input("Enter rate: "))

t = float(input("Enter time: "))

si = p * r * t / 100

print("Simple Interest =", si)

print("\n\n")

#Q2

d1 = float(input("Enter Sunday Temperature: "))

d2 = float(input("Enter Monday Temperature: "))

d3 = float(input("Enter Tuesday Temperature: "))

d4 = float(input("Enter Wednesday Temperature: "))

d5 = float(input("Enter Thursday Temperature: "))

d6 = float(input("Enter Friday Temperature: "))

d7 = float(input("Enter Saturday Temperature: "))

avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7

print("Average Temperature =", avg)

print("\n\n")

#Q3

import math

x = int(input("Enter x: "))

y = int(input("Enter y: "))

z = int(input("Enter z: "))
res = 4 * x ** 4 + 3 * y ** 3 + 9 * z + 6 * math.pi

print("Result =", res)

print("\n\n")

#Q4

totalSecs = int(input("Enter seconds: "))

mins = totalSecs // 60

secs = totalSecs % 60

print(mins, "minutes and", secs, "seconds")

print("\n\n")

#Q5

y = int(input("Enter year to check: "))

print(y % 4 and "Not a Leap Year" or "Leap Year")

print("\n\n")

#Q6

x = int(input("Enter first number: "))

y = int(input("Enter second number: "))

print(x % y and "Not Fully Divisible" or "Fully Divisible")

print("\n\n")

#Q7

x = int(input("Enter a two digit number: "))

y = x % 10 * 10 + x // 10

print("Reversed Number:", y)

print("\n\n")

#Q8
x = int(input("Enter a three digit number: "))

d1 = x % 10

x //= 10

d2 = x % 10

x //= 10

d3 = x % 10

y = d1 * 100 + d2 * 10 + d3

print("Reversed Number:", y)

print("\n\n")

#Q9

d = int(input("Enter day: "))

m = int(input("Enter month: "))

n = (m - 1) * 30 + d

print("Day of the year:", n)

print("\n\n")

#Q10

y = float(input("How many years? "))

d = y * 365

h = d * 24

m = h * 60

s = m * 60

print(y, "years is:")


print(d, "days")

print(h, "hours")

print(m, "minutes")

print(s, "seconds")

print("\n\n")

#Q11

a = int(input("What is your age? "))

print("In ten years, you will be", a + 10, "years old!")

print("\n\n")

#Q12

import random

a = random.randint(0, 5)

b = random.randint(0, 5)

c = a ** b

print("Random number between 0 and 5 (A) :", a)

print("Random number between 0 and 5 (B) :", b)

print("A to the power B =", c)

print("\n\n")

#Q13 not coming

#Q14

import random

a = random.randrange(100, 999, 5)

b = random.randrange(100, 999, 5)

c = random.randrange(100, 999, 5)

print("\n\n")

#Q15
import random

otp = random.randint(100000, 999999);

print("OTP:", otp);

print("\n\n")

#Q16 not coming

#Q17

import math

a = float(input("Enter base: "))

b = float(input("Enter height: "))

x = float(input("Enter angle: "))

c = math.sqrt(a ** 2 + b ** 2)

print("Hypotenuse =", c)

print("Generated Numbers:", a, b, c)

print("\n\n")

#Q18

import math

area = float(input("Enter area of sphere: "))

r = math.sqrt(area / (4 * math.pi))

print("Radius of sphere =", r)

print("\n\n")

#Q19
str = input("Enter string: ")

len = len(str)

opStr = str * len

print("Result", opStr)

print("\n\n")

#Q20

import math

r=8

h = 15

v = math.pi * r * r * h

print("Volume of Cylinder =", v)

print("\n\n")

#Q21

import math

side = float(input("Enter side: "))

area = math.sqrt(3) / 4 * side * side

print("Area of triangle =", area)

print("\n\n")

#Q22

import math

r = float(input("Enter radius of sphere: "))

v = 4 / 3 * math.pi * r ** 3
print("Volume of sphere = ", v)

print("\n\n")

#Q23

p = float(input("Enter principal: "))

r = float(input("Enter rate: "))

t = float(input("Enter time: "))

si = p * r * t / 100

amt = p + si

print("Amount Payable =", amt)

print("\n\n")

#Q24

p = float(input("Enter principal: "))

r = float(input("Enter rate: "))

t = float(input("Enter time: "))

amt = p * (1 + r / 100) ** t

print("Amount Payable =", amt)

print("\n\n")

#Q25

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

b = int(input("Enter b: "))

res = a ** 3 + b ** 3 + 3 * a ** 2 * b + 3 * a * b ** 2

print("Result =", res)


RESULT

Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: C:/Users/Aditi Tiwari/AppData/Local/Programs/Python/Python310/fyfty.py

Enter principal: 5000

Enter rate: 12

Enter time: 20

Simple Interest = 12000.0

Enter Sunday Temperature: 21

Enter Monday Temperature: 22

Enter Tuesday Temperature: 23

Enter Wednesday Temperature: 24

Enter Thursday Temperature: 25

Enter Friday Temperature: 26

Enter Saturday Temperature: 27

Average Temperature = 24.0

Enter x: 1

Enter y: 2

Enter z: 3

Result = 73.84955592153875

Enter seconds: 11
0 minutes and 11 seconds

Enter year to check: 2024

Leap Year

Enter first number: 2300

Enter second number: 4523

Not Fully Divisible

Enter a two digit number: 25

Reversed Number: 52

Enter a three digit number: 123

Reversed Number: 321

Enter day: 30

Enter month: 2

Day of the year: 60


How many years? 16

16.0 years is:

5840.0 days

140160.0 hours

8409600.0 minutes

504576000.0 seconds

What is your age? 16

In ten years, you will be 26 years old!

Random number between 0 and 5 (A) : 5

Random number between 0 and 5 (B) : 4

A to the power B = 625

OTP: 913189

Enter base: 22

Enter height: 64

Enter angle: 90

Hypotenuse = 67.67569726275453
Generated Numbers: 22.0 64.0 67.67569726275453

Enter area of sphere: 23120

Radius of sphere = 42.89325287434272

Enter string: eka

Result ekaekaeka

Volume of Cylinder = 3015.928947446201

Enter side: 3

Area of triangle = 3.897114317029974

Enter radius of sphere: 32

Volume of sphere = 137258.27743044044

Enter principal: 20000

Enter rate: 24

Enter time: 12
Amount Payable = 77600.0

Enter principal: 2300

Enter rate: 12

Enter time: 6

Amount Payable = 4539.792175923202

Enter a: 12

Enter b: 23

Result = 42875

You might also like