The program will continue asking the user for IP addresses until they enter a q or...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The program will continue asking the user for IP addresses until they enter a q or Q to exit the program. Here's pseudocode to help you solve this problem: # Ask the user to input an IP address or 'Q' to quit # while the user has not entered 'Q' or 'q' to quit #split the user input at each period and store the parts in a list #if there are not 4 parts in the list #display an error message # else #set error flag to False # for each part in the list. # if the part is not a number or if it is not between 0 and 255 #display an error message #set error flag to True break the loop #if no error has been displayed (i.e., error flag is False) replace each period in the user input with a colon #display the new formatted IP address # ask the user to input an IP address or 'Q' to quit You may want to consider copying the above pseudocode into your Python file and use it as comments that can also guide you as you write this program. Sample output: Please enter an IP address or 'Q' to quit: 122.44.33 Error: An IP address should consist of 4 parts separated by periods. Please enter an IP address or 'Q' to quit: 122.44.33.x Error with x: Each part of the IP address should be a number between 0 and 255. Please enter an IP address or 'Q' to quit: 122.444.33.x Error with 444: Each part of the IP address should be a number between 0 and 255. Please enter an IP address or 'Q' to quit: 122.44.33.89 Reformatted IP address: 122:44:33:89 Please enter an IP address or 'Q' to quit: q The program will continue asking the user for IP addresses until they enter a q or Q to exit the program. Here's pseudocode to help you solve this problem: # Ask the user to input an IP address or 'Q' to quit # while the user has not entered 'Q' or 'q' to quit #split the user input at each period and store the parts in a list #if there are not 4 parts in the list #display an error message # else #set error flag to False # for each part in the list. # if the part is not a number or if it is not between 0 and 255 #display an error message #set error flag to True break the loop #if no error has been displayed (i.e., error flag is False) replace each period in the user input with a colon #display the new formatted IP address # ask the user to input an IP address or 'Q' to quit You may want to consider copying the above pseudocode into your Python file and use it as comments that can also guide you as you write this program. Sample output: Please enter an IP address or 'Q' to quit: 122.44.33 Error: An IP address should consist of 4 parts separated by periods. Please enter an IP address or 'Q' to quit: 122.44.33.x Error with x: Each part of the IP address should be a number between 0 and 255. Please enter an IP address or 'Q' to quit: 122.444.33.x Error with 444: Each part of the IP address should be a number between 0 and 255. Please enter an IP address or 'Q' to quit: 122.44.33.89 Reformatted IP address: 122:44:33:89 Please enter an IP address or 'Q' to quit: q
Expert Answer:
Related Book For
Auditing Cases An Interactive Learning Approach
ISBN: 978-0132423502
4th Edition
Authors: Steven M Glover, Douglas F Prawitt
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
What is the advantage of using computing to simulate an automobile crash test as opposed to actually staging a crash?
-
Although Nalini Nadkarni's studies of the rain forest canopy addressed a question related to ecosystem structure, the patterns of nutrient storage in rain forest canopy resulted from the biology of...
-
In the face of your supervisor's directive to eliminate certain sections of findings from the report, how would you apply the Ethical Decision-Making Model to align your response with the NASW Code...
-
Although everyone makes mistakes, describe how history repeats itself when there are patterns of progress and regression in the provision of patient care. In forming your answer, consider how...
-
Price Company issues $400,000, 20-year, 7% bonds at 101. Prepare the journal entry to record the sale of these bonds on June 1, 2017.
-
The maintenance expenses on a rental house you own average $200 a month and property taxes are $4,800 annually. The house cost $238,500 when you purchased it four years ago. The house was recently...
-
In the past, 30% of a country club's members brought guests to play golf sometime during the year. Last year, the club initiated a new program designed to encourage members to bring more guests to...
-
Fill in the code ClosenessCentrality.java to identify the 10 most influential nodes of this network (based on their closeness centrality value) (can add new private methods/variables) 1234561 7 8 9...
-
1.) The molar mass of CaCl2 is 110.98 g. By how many degrees would the freezing point decrease in a solution of 0.420 kg of water containing 12.98 g of CaCl2? The Kf of water is 1.86C/m, and the van...
-
A company had sales of $600 and costs of $300. Depreciation was an additional $150, and interest paid was $30. Taxes were 40% of pretax income. Dividends were $30. Beginning net fixed assets were...
-
The financial condition of two companies is expressed in the following accounting equation: Common Stock + Retained Earnings $ 2,464 + $ 7,410 + Allen White Assets $ 11,200 = $ 13,920 Required a....
-
Amir's Auto Sales is considering opening a new sales location across town. Amir's expects the new venture to face relevant fixed costs of $ 3 7 2 , 5 3 3 . Amir's expects to sell the average car for...
-
The first major step in weighing an international strategic option is the environmental assessment. What are the five major environmental variables that focus on the future interest of the firm?
-
The Higher the time period of the financial security the higher the. ............... risk. O a. Maturity O b. Default and Maturity Oc. Default O d. Liquidity
-
For the periodic processes shown below: a. Schedule the processes using an RMS policy. b. Schedule the processes using an EDF policy. In each case, compute the schedule for an interval equal to the...
-
For the periodic processes shown below: a. Schedule the processes using an RMS policy. b. Schedule the processes using an EDF policy. In each case, compute the schedule for an interval equal to the...
-
For the given periodic process execution times and periods (P1 has the highest priority), show how much CPU time of higher-priority processes will be required during one period of each of the...
Study smarter with the SolutionInn App