1. Write a function which will return the fraction part after dividing a number by
another. The range should be within 0 and 1. Exception: Since dividing anything by
0 results in error so if the denominator is 0, the function will return 0 instead of
attempting the division.
2. You are one of the gym instructors at AmiKenoMota. You decide to provide a
customized diet and exercise plans based on the BMI of an individual. You measure
the weight in kilograms and height in meters and calculate the BMI before a plan
can be decided. Write a BMI function that takes in two values, weight in kg and
height in cm and print the score along with the condition. (Make sure to convert cm
into m before calculation)
𝐵𝑀𝐼 = 𝑘𝑔/𝑚2
Based on the BMI score return the following output.
● < 18.5- Underweight
● 18.5 – 24.9 – Normal
● 25 -30 – Overweight
● > 30 – Obese
3. Write a function which will take 3 arguments minimum, maximum and divisor.
You have to find all the numbers that are divisible by the divisor where minimum
value is inclusive and maximum value is exclusive. Add all the numbers and return
(0, 10, 2)
(3, 16, 3)
(‘Beef Burger’, ‘Dhanmondi’)
(‘email@example.com’, ‘sheba.xyz’, ‘kaaj.com’)
4. You want to order Burger from Chillox through the FoodPanda App. You have to
calculate the total price. Write a function which will take the name of the burger and
place(Mohakhali/Outside of Mohakhali) as input. Use default argument technique
for taking place input.
BBQ Chicken Cheese Burger 250
Beef Burger 170
Naga Drums 200
Hint: Total Price = meal_cost + delivery_charge + tax
● If your home is in Mohakhali area then your delivery charge is 40 taka
else 60 taka
● Your tax rate is 8% of your meal.
5. A company named Sheba.xyz has recently moved from their old domain to a new
domain. However, a lot of the company email addresses are still using the old one.
Write a function in python that replaces this old domain with the new one in any
outdated email addresses. Keep same if the email address contains the new domain.
(Do not use builtin replace function)
Firstly, define a “replace_domain” function which accepts three parameters
*The email address to be checked
*The new domain
* The old domain (Use Default argument technique to handle this)
Vowels: e, e, o. Total number of vowels: 3
No vowels in the name
Not a palindrome
11 years, 10 months and 5 days
10 years, 11 months and 20 days
6. Write a function which takes only your full name as input and finds the total
number of vowels in that input. Output every vowel and at the end output the total
number of vowelsfound. If your name does not contain any vowel then yourfunction
should print “No vowels in the name!”.
7. Write a program which checks whether a given string is a palindrome or not. Note:
A palindrome is a word, phrase, or sequence that reads the same backward as
forward. For palindrome, any spaces in middle are not considered and should be
8. Write a function which takes a number of days as input and prints total number of
years, number of months and remaining number of days as output.
(‘my favourite animal is a dog. a dog has sharp teeth so that it can eat flesh very easily.
do you know my pet dog’s name? i love my pet very much.’)
My favourite animal is a dog. A dog has sharp teeth so that it can eat flesh very easily. Do
you know my pet dog’s name? I love my pet very much.
9. You are a class teacher at a kindergarten school. As a task, you asked your
students to write a paragraph. Unfortunately, you notice that most of the students
did not use capital letters correctly. Your task is to write a function which takes a
string as its only parameter and returns a new copy of the string that has been
correctly capitalized. Your function should:
● Capitalize the first letter in the string
● Capitalize the first letter after a full-stop, exclamation mark or question mark
● Capitalize the word “i” if it is in lowercase.
Summary: You have to write a function that reads a string from the user and
capitalizes. The string is then returned and displayed.