Computers and Technology

How do you prevent a while loop from becoming an infinite loop? How could internal documentation improve this program?
x = 90
a = 37
c = x/a
print(c)
You learned in this unit that Python requires your syntax to be strictly correct. For example, if you don’t indent a line after an if statement, your program will crash, and you will get an error message. Why do you think Python is designed with such strict rules? Would it be better if Python were more flexible? Why or why not?
Consider this program:
flavors = ["mild", "medium", "hot", "extra hot"]
choice = int(input("How many options do you want?"))
for i in range(choice):
print("You can order", flavors[i])
Can you anticipate a situation in which this program will crash? What could you do to prevent that situation from happening?
You learned in this lesson that you can use negative index numbers to access list items starting at the end of the list. In what situations might this be useful?

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:30, donmak3833
Agood flowchart alludes to both the inputs and outputs you will need to receive and give to the user. true or false?
Answers: 3
image
Computers and Technology, 23.06.2019 22:30, keel5468
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
image
Computers and Technology, 23.06.2019 23:30, yasarhan2
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
image
Computers and Technology, 24.06.2019 09:30, nialphonsa
Atype of researcher who uses computers to make sense of complex digital data
Answers: 1
Do you know the correct answer?
How do you prevent a while loop from becoming an infinite loop? How could internal documentation im...

Questions in other subjects:

Konu
Mathematics, 17.07.2019 08:30