Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer as soon as possible using python as the programming language Exercise A: Exercise B: For this exercise you will design and implement a
Please answer as soon as possible using python as the programming language
For this exercise you will design and implement a program that asks for the user's name, the current year, and the year in which the user was born, and then calculates and prints exactly three possible values for that user's age. This program must not contain if statements or branch in any way. A. a clarifying example, if the user says the current year is 2021 and that their birth year was 1980 , then your program must respond that the user may be 40 or 41 years of age, or that they have an age 1 of 10 (which would occur if they were born on a "leap-day" - i.e., February 29). In order to complete this task, you will need to: - use the "int" function to convert the input string to an integer - determine all three age calculations (e.g., given 2021 and 1980 , how to reach 41,41 and 10 ) For this exercise you will design and implement a program to perform the "phone number trick", which takes the seven (7) digits of a phone number from the user and subjects it to a serias of calculations that produce that same number as a result. Consider the sample transcript belov Enter your seven-digit phone number? 5202600 Your prefix is 520. Multiply this by 80 , and the result is: 41600 Add 1 to that result and multiply it by 250 , and the result is: 1040e2se Your line number is 2600 . Add this to the previous result twice, and the result is: 16495450 Subtract 250 from that result and divide it by 2 , and the result is: 5202600 In order to complete this task, you will need to: - determine how to use floor division for the first three digits (or "prefix") of a phone number - determine how to use modulation for the last four digits (or "line number") of a phone number Your submission for this exercise: - must take a seven-digit phone number (n.b., no "area code") with only a single call to input - must be a source code file with filename 'comp1405_w23_\#\#\#\#\#\#\#\#\#_tutorial_02_b.py Exercise A:
Exercise B:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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