Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that reads a mobile phone number and validates it. If it is valid, the program simply prints the phone number. Hint:
Write a program that reads a mobile phone number and validates it. If it is valid, the program simply prints the phone number. Hint: Mobile phone numbers in Kuwait are 8 digits and start with 5, 6 or 9. Desired output format: (user input is underlined) Enter your mobile number: 123. Invalid number! Please re-enter: 56789 Invalid number! Please re-enter: 55219874 Thank you! Your phone number is: 55219874 Enter your mobile number: 987654 Invalid number! Please re-enter: 98765432 Thank you! Your phone number is: 98765432 Exercise 2: Write a program that reads as input your date of birth. It should validate it as follows: day (1-30), month (1-12) and year (1900-2019). If the date is valid, print it in this format: day-month-year. Desired output format: (user input is underlined) Enter your day of birth: 52 Invalid day! Please re-enter: 25 Enter your month of birth: 13 Invalid month! Please re-enter: 14 Invalid month! Please re-enter: 10 Enter your year of birth: 2020 Invalid year! Please re-enter: 1850 Invalid year! Please re-enter: 1980 Thank you! Your date of birth is: 25-10-1980 Exercise 3: Write a program that reads the number of items n in a receipt. It should then ask the user to enter the n prices of those items and validate each price is in [0-1000]. Finally, it prints the sum of the bill. Desired output format: (user input is underlined) Enter the no. of items: 5 Enter item's price: 20 Enter item's price: 40 Enter item's price: 1222 Error: price should be 0-1000. Re-enter item's price: 60 Enter item's price: 5 Error: price should be 0~1000. Re-enter item's price: 40 Enter item's price: 30 The bill's total is: 190
Step by Step Solution
★★★★★
3.52 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
Heres the solution to your exercises in Python Exercise 1 Validate and Print Mobile Phone Number pyt...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started