Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (4 points) In the United States, phone numbers are comprised of a 3-digit area code followed by a 7-digit number. Area codes of
1. (4 points) In the United States, phone numbers are comprised of a 3-digit area code followed by a 7-digit number. Area codes of 800, 888, 877, 866, 855, 844, and 833 denote toll-free numbers. Write a program named toll free numbers.py that allows the user to enter a 10-digit U.S. phone number as a single integer. Your program should then print whether or not that number is toll-free. You may assume that the user will always enter a valid phone number. Hint: Since the 10-digit phone number is stored into a single variable, can you use integer division and/or mod to get the area code by itself? Example program run (underlined parts indicate what the user enters) Enter a 10-digit phone number (no spaces or dashes): 8778675309 That number is toll-free! Example program run (underlined parts indicate what the user enters) Enter a 10-digit phone number (no spaces or dashes): 9018675309 That number is not toll-free!
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