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

Assignment 3

Uploaded by

studymeraj
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)
28 views2 pages

Assignment 3

Uploaded by

studymeraj
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
You are on page 1/ 2

Centre for Data Science

Institute of Technical Education & Research, SOA, Deemed to be University

Applied Computational Thinking (CSE 1401)


M INOR A SSIGNMENT-3: P YTHON FUNDAMENTALS - M ATHS , C ONDITIONALS

1. Write a python program to calculate the power of a number.

2. Write a python program to check is the input number is zero.

3. Write a python program to check if a number is positive or negative.

4. Write a python program to compare two numbers.

5. Write a python program to calculate area of a rectangle.

6. Write a python program to Identifying the largest number among three numbers and print the largest
one.

7. Write a python program to find if a number is divisible by another number.

8. Write a python program to check the user belong to which age group. (Ex. Toddler, teenager, adult,
senior citizen.)

9. Write a python program to check if two variables point to the same object in memory, using is and is
not operator.

10. Write a python program for the following problem.


Let us consider, a logistic company need to send some boxes with some items. Ask user how many
items are there and how many items a box can hold. Write a program to determine, how many full
boxes are made and how many leftover items will be there, using floor division and modulus operator.

11. Write a program that checks if a number num is a multiple of 5. Return True if it is a multiple,
otherwise return False.

12. Write a python program to check eligibility based on age and height.

13. Write a python program that determines loan eligibility based on the following conditions:

• If income is greater than 50,000 and credit score is above 700, they are eligible.
• If income is between 30,000 and 50,000, they are eligible only if: Their credit score is above
750 or they have been employed for more than 5 years.
• If income is less than 30,000, they are not eligible.

14. Write a Python program that takes a word as input and categorizes the word based on length:

• Words with length less than 4 are ”Short”


• Words with length between 4 and 7 are ”Medium”
• Words with length greater than 7 are ”Long”

15. Write a program that compares the sum of digits of two integers n1 and n2.

16. Write a Python program that takes three integers representing a day, month, and year. The program
should check if this date is valid considering:

• The day is valid for the given month and year (accounting for leap years).
1
Centre for Data Science
Institute of Technical Education & Research, SOA, Deemed to be University

• The month should be between 1 and 12.


• The day should be within the possible days of that month.

If valid, return ”Valid Date”, otherwise ”Invalid Date”.

17. Create a program that asks the user for the total purchase amount and applies a discount:

• Over 1000: 10% discount


• Between 500 and 1000: 5% discount
• Below 500: No discount

18. Create a number guessing game where the program generates a random number between 1 and 100.
The user must guess the number, and the program gives hints like ”Too high” or ”Too low” until the
correct number is guessed.

19. Write a program that calculates the Body Mass Index (BMI) given a person’s weight (in kg) and
height (in meters) and classifies the result according to these ranges:

• BM I < 18.5: Underweight


• 18.5 ≤ BM I < 24.9 : Normal weight
• 25 ≤ BM I < 29.9: Overweight
• BM I ≥ 30: Obesity
Hint: Formula: BM I = weight/(height)2

20. Write a program that takes a number (1–7) as input and prints the corresponding day of the week (1
= Sunday, 2 = Monday, etc.). If the input is not within 1–7, print Invalid day.

21. Write a program that calculates the shipping cost based on the weight of a package and the shipping
method:

• Standard (1–10 kg): $5 + $0.75 per kg


• Express (1–10 kg): $10 + $1.25 per kg
• Standard (over 10 kg): $10 + $0.50 per kg
• Express (over 10 kg): $20 + $1per kg

Take the weight and shipping method as input, and print the total cost.

22. Write a program that takes an integer and classifies it based on these nested conditions:
If the number is divisible by 2, check if it’s also divisible by 3:
• If yes, print Divisible by both 2 and 3.
• If no, print Divisible by 2 but not by 3.
If the number is divisible by 3 but not by 2, print Divisible by 3 but not by 2.
If the number is not divisible by either, print Not divisible by 2 or 3.

You might also like