Question

In: Computer Science

​​​​​​​ASAP PLEASE Write a python code that prompts a user to input a 10-digit phone number....

​​​​​​​ASAP PLEASE

  1. Write a python code that prompts a user to input a 10-digit phone number. The output of your code is the phone number’s  area code, prefix and line number separated with a space on a single line

e.g

INPUT

2022745512

OUTPUT

202 274 5512

  1. write a code that will prompt a user to input 5 integers and output its largest value. PYTHON

e.g

INPUT

2

4

6

1

3

OUTPUT

Largest value is: 6

Solutions

Expert Solution

1)

Python code:

#accepting number
number=input()
#printing number seperating area code and prefix
print(number[:3]+" "+number[3:6]+" "+number[6:])

Screenshot:


Input and Output:

2)

Python code:

#accepting first number as largest
largest=int(input())
#loop to accept remaining 4 numbers
for i in range(4):
#accepting next number
num=int(input())
#checking if it is the largest
if(num>largest):
#setting it as largest
largest=num
#printing the Largest value
print("Largest value is:",largest)

Screenshot:


Input and Output:


Related Solutions

You will write a program that prompts the user to enter a 7-digit phone numbers, and...
You will write a program that prompts the user to enter a 7-digit phone numbers, and finds the 3- and 4-letter words that map to the phone number, according to the restrictions outlined earlier. A sample run: unixlab% java MapNumbers Enter name of dictionary file: words10683 Enter a test word (3 letters): cat Test word maps to 228 Enter telephone number (7 digits, no 0's or 1's, negative to quit): 2282273 Options for first 3 digits: act cat bat Options...
First, the Python program prompts user to enter user information (name, email, and phone number). Then...
First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type: 1. Cat Fish 2. Red Fish 3. Any other fish Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria: Criteria: Length: FISHTYPE - Cat Fish <10:...
Write a program that prompts the user to input a decimal number and outputs the number...
Write a program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer.
Write a program that does the following: Prompts the user for a 5-digit number. Divides that...
Write a program that does the following: Prompts the user for a 5-digit number. Divides that number into its separate five digits. Adds up the sum of those five digits. Outputs that sum You should test your program with at least the following test cases. (I am to be programming with python) >>> RESTART: /Users/mamp/Desktop/Desktop - Enter a 5-digit number: 12345 15 >>> RESTART: /Users/mamp/Desktop/Desktop - Enter a 5-digit number: 00000 0 >>> RESTART: /Users/mamp/Desktop/Desktop - Enter a 5-digit number:...
Write a Python program which prompts the user to input a string. Then, print the string...
Write a Python program which prompts the user to input a string. Then, print the string in reverse to the terminal Sample output Please enter a word: "zeus" The reverse of zeus is suez Hint: There are several ways to accomplish this. Recall that a string is an itterable object and therefore can be used with a for loop
Write a program in c++ that prompts the user to input a coin collection of number...
Write a program in c++ that prompts the user to input a coin collection of number of quarters, dimes, nickels and pennies. The program should then convert the coin collection into currency value as dollars. The coin values should all be whole numbers and the resulting currency value should be displayed with two decimals. An example of user interaction is as follows: Coin Convertor Enter number of quarters: 3 Enter number of dimes: 1 Enter number of nickels: 4 Enter...
Please code C# 10. Write a program that allows a user to input names and corresponding...
Please code C# 10. Write a program that allows a user to input names and corresponding heights (assumed to be in inches). The user can enter an indefinite number of names and heights. After each entry, prompt the user whether they want to continue. If the user enters true, ask for the next name and height. If the user enters false, display the name of the tallest individual and their height. Sample run: “Name?” James “Height?” 50 “Continue?” True “Name?”...
In python Write the code to ask a user to enter a number in the range...
In python Write the code to ask a user to enter a number in the range of 1-100. Have the code checked to make sure that it is in this range. If it is not, let the user re-enter the number. The user should be able to re-enter numbers until the number is within the correct range.
Please code C# 8. Write a program that prompts the user to enter an integer. The...
Please code C# 8. Write a program that prompts the user to enter an integer. The program then determines and displays the following: Whether the integer is divisible by 5 and 6 Whether the integer is divisible by 5 or 6
Please write in Python code please: Write a program that asks the user to enter 5...
Please write in Python code please: Write a program that asks the user to enter 5 test scores between 0 and 100. The program should display a letter grade for each score and the average test score. You will need to write the following functions, including main: calc_average – The function should accept a list of 5 test scores as an input argument, and return the average of the scores determine_grade – The function should accept a test score as...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT