Pressing ctrl-c in the python shell

Assignment Help Business Management
Reference no: EM131406432

USE PYTHON 3 ONLY

1a) Write an infinite while loop that prints out:

"I will not write on the board"

1b) You can interrupt the above loop by pressing ctrl-c in the Python shell.  A neater way of handling the escape from this infinite loop is to enclose this code in a try-except block.

2a) Write a while loop that iterates 10 times and prints out the iteration number to the Python shell.  Start the iteration at 1.

2b) Modify the loop so that it iterates 10 times but the iteration number is advanced by 2 rather than by 1.

3) Write an infinite loop that gets a random number between

1 and 8.  Ask the user to guess a number between 1 and 8.

If the user's guess matches the random number, print a message congratulating the user and then break out of the loop.

Otherwise, tell the user to try again.

4a) Write a for loop that iterates from 3 to 98 in steps of 5.  Print out the value each time through the loop.

4b) For comparison, write a while that works exactly the same way.

5) Write nested for loops that print out the value of each index for each iteration through the loop.  The first loop should start at 1 and end at 3 and the second loop should start at 10 and end at 1.

Reference no: EM131406432

Questions Cloud

What change in design do you recommend based on your finding : What was learned from the accident (how can an event such as this be prevented in the future?) What specific changes in design, control, operation, training and/or regulation do you recommend based on your findings?
Why is ritualism central in all forms of religious worship : Webster dictionary gave a number of definitions of ‘Ritual': "a system of rites, a Ceremonial act or action, a customarily repeated often formal act or series of acts". In our everyday dealings there are different forms of actions taken that are r..
Automobile class for a dealership : Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year, vin number, miles per gallon, and speed. Include get and set methods for each field
Primary target of systems design : What is the primary target of systems design and what phases are included in the systems design?
Pressing ctrl-c in the python shell : You can interrupt the above loop by pressing ctrl-c in the Python shell.  A neater way of handling the escape from this infinite loop is to enclose this code in a try-except block.
How an interrupt handler would address the event : Outline the process that occurs when a hardware interrupt is generated by a disk controller. Set the context for the interrupt (disk read or write) and describe how an interrupt handler would address the event.
Return on security investment : Return on Security Investment (ROSI) Actions for 'Return on Security Investment (ROSI)' Must post first.SubscribeHide Description This discussion item is part of the Analysis of Alternatives exercise.
Existing network configuration : What potential problems can this upgrade cause? What must you verify about the existing network configuration before you perform the upgrade.
Implement iso 26000 guidelines for the company : Determine whether the current organizational strategies align with your vision for the ISO 26000 guidelines. Support your perspective with specific examples.

Reviews

Write a Review

 

Business Management Questions & Answers

  Which location would result in the lower transportation cost

Transportation cost from each potential location and existing locations are shown in the following table. Which location would result in the lower transportation cost for the system?

  What overall advantage or disadvantages of competitors

What overall advantage or disadvantages would these competitors have in the marketplace? The Porter 5-forces model is a good tool to organize the work when defining the competitive environment.

  Prints all of the prime numbers

Using C++, write a program that finds and prints all of the prime numbers between 3 and 100. A prime number is a number such that 1 and itself are the only numbers that evenly divide it (for example, 3, 5, 7, 11, 13, 17, ...).

  Easy-to-assemble furniture at economical prices

The furniture manufacturer, IKEA, has a core competency in offering well-designed and easy-to-assemble furniture at economical prices

  Issue of currency restrictions

If you were tasked to advise Belarus during this time on the issue of currency restrictions, are there other options that the country could have pursued to try and stabilize the currency and market, even if they still needed to lift restrictions? ..

  Determining gross income

Donald was killed in an accident while he was on the job in 2013. His employer had provided Donald with group term life insurance of $160,000 (twice his annual salary), which was payable to his widow, Darlene Premium on this policy totalling $2,70..

  People who face ethical issues

Ferrell states that "People who face ethical issues (in the workplace) often base their decisions on their own values and principles of right and wrong." Accordingly, how did you arrive at the ethical/ moral orientation that you hold now? (i.e., what..

  Contemporary decision making

A warehouse manager, Jane, needs to determine how many order pickers she should staff. The daily demand is normally distributed with a mean of 58,855 parts and a standard deviation of 4876 parts. The number of parts that order pickers pick daily i..

  Amt tax planning - sale of a building

AMT tax planning - sale of a building - What are the relevant tax issues that Celine faces in making her decision?

  The machine with the biggest inventory

In a process, the machine with the biggest inventory in front of it is the bottleneck

  How major industries of australian vacation travel effects

Describe how the major industries of 1) Australian and New Zealander vacation travel, 2) cosmetic and 3) precooked food are affected by the effects of the demographic trends.

  How the test should be conducted

Finally, the paper should include your recommendation for a proposed 24-month cycle business contingency testing plan -- what should be tested and how the test should be conducted.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd