Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

please here is a screenshot of my lab phone number break down , python

# 4.16 LAB: Phone number breakdown

## Objective
Given an integer representing a 10-digit phone number, you need to output the area code, prefix, and line number using the format `(800) 555-1212`.

### Example
**Input:**
```
8005551212
```
**Output:**
```
(800) 555-1212
```

### Hints
- **Hint 1:** Use `%` to get the desired rightmost digits.
  - Example: The rightmost 2 digits of `572` is obtained by `572 % 100`, which yields `72`.

- **Hint 2:** Use `//` to shift right by the desired amount.
  - Example: Shifting `572` right by 2 digits is accomplished with `572 // 100`, resulting in `5`. (Recall that integer division discards the fraction).

**Note:** For simplicity, assume any part starts with a non-zero digit. Thus, `0119998888` is not considered valid.

## Lab Activity
**Task:** Complete the following code in `main.py`.

```python
phone_number = int(input())

''' Type your code here. '''
```

Complete the code to achieve the desired output format.
expand button
Transcribed Image Text:# 4.16 LAB: Phone number breakdown ## Objective Given an integer representing a 10-digit phone number, you need to output the area code, prefix, and line number using the format `(800) 555-1212`. ### Example **Input:** ``` 8005551212 ``` **Output:** ``` (800) 555-1212 ``` ### Hints - **Hint 1:** Use `%` to get the desired rightmost digits. - Example: The rightmost 2 digits of `572` is obtained by `572 % 100`, which yields `72`. - **Hint 2:** Use `//` to shift right by the desired amount. - Example: Shifting `572` right by 2 digits is accomplished with `572 // 100`, resulting in `5`. (Recall that integer division discards the fraction). **Note:** For simplicity, assume any part starts with a non-zero digit. Thus, `0119998888` is not considered valid. ## Lab Activity **Task:** Complete the following code in `main.py`. ```python phone_number = int(input()) ''' Type your code here. ''' ``` Complete the code to achieve the desired output format.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education