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

Data Science Lab Assignment

Uploaded by

anjan ram
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Data Science Lab Assignment

Uploaded by

anjan ram
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Exercise-1(23-8-2024)

1. Write a program that asks the user to input a temperature in Celsius and converts it to Fahr-
enheit. Use the formula: F = (C * 9/5) + 32. Make sure to cast the input to a float.

2. Create a program that asks the user for their birth year and calculates their approximate age.
Use the current year (2024) for the calculation.

3. Compound Interest Calculator: Create a program that calculates compound interest. The
program should ask the user for:
● The initial principal amount (P)
● The annual interest rate (r) as a percentage
● The number of years (t)
● The number of times interest is compounded per year (n)

The program should then calculate and display the final amount using the compound
interest formula: A = P * (1 + r/n)^(n*t) Where:

● A is the final amount


● P is the principal balance
● r is the annual interest rate
● n is the number of times interest is compounded per year
● t is the number of years

4. If the ages of Ram, Shyam and Ajay are input through the keyboard,write a program to de-
termine the youngest of the three.

5. Write a program that converts percentages to one of the following letter grades:
A (90 – 100%), B (80 – 89%), C (70 – 79%), D (60 – 69%), F (0 – 59%).

6. A five-digit number is entered through the keyboard. Write a program to obtain the
reversed number and to determine whether the original and reversed numbers are equal or
not.

7. A certain grade of steel is graded according to the following conditions:


(i) Hardness must be greater than 50
(ii) Carbon content must be less than 0.7
(iii) Tensile strength must be greater than 5600

The grades are as follows:


Grade is 10 if all three conditions are met
Grade is 9 if conditions (i) and (ii) are met
Grade is 8 if conditions (ii) and (iii) are met
Grade is 7 if conditions (i) and (iii) are met
Grade is 6 if only one condition is met
Grade is 5 if none of the conditions are met

8. Write a program, which will require the user to give values of hardness, carbon content and
tensile strength of the steel under consideration and output the grade of the steel.

9. If the three sides of a triangle are entered through the keyboard, write a program to check
whether the triangle is isosceles, equilateral, or right angled triangle.
Lab Exercise-1(23-8-2024)

10. Little Bob loves chocolate, and he goes to a store with Rs. N in his pocket. The price of
each chocolate is Rs. C. The store offers a discount: for every M wrappers he gives to the
store, he gets one chocolate for free. This offer is available only once. How many
chocolates does Bob get to eat?

11. An university is setting up a new lab at their premises. Design an algorithm and write
Python code to determine the approximate cost to be spent for setting up the lab. Cost for
setting the lab is sum of cost of computers, cost of furniture and labour cost. Use the
following formulae for solving the problem:

Cost of computer = cost of one computer * number of computers

Cost of furniture = Number of tables * cost of one table + number of chairs * cost of one
chair

Labour cost = number of hours worked * wages per hour

Note: The values to the variables should be directly given in the program.

You might also like