Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 1 : phone.py For the first program in today's lab, you will need to write a program that formats a given phone number as

Program 1:
phone.py
For the first program in today's lab, you will need to write a program that formats a given phone number as input. Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800)555-1212.
If the input is:
8005551212
The output in the terminal should be:
(800)555-1212
For simplicity, assume any part starts with a non-zero digit. So,0119998888 is not allowed.
Example Terminal Output:
Please enter your phone number: 5551845433
Phone Number: (555)184-5433
Hints
Use % to get the desired rightmost digits.
a. Ex: The rightmost 2 digits of 572 is gotten by 572%100, which is 72.
Use // to shift right by the desired amount.
a. Ex: Shifting 572 right by 2 digits is done by 572??100, which yields 5.(Recall integer division discards the fraction).
Skills Covered
Using the modulo and floor division operators
Deliverables
For this program you will need to provide the python file containing your code as well as a screenshot of the output of your program. Please name your files as follows:
Python Files
lastname_firstname_filename.py
For example: hawamdeh_faris_phone.py
Screenshots
lastname_firstname_filename.png
For example: hawamdeh_faris_phone.png
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions