Given program identify the number of iterations, and
predict the output
n = 5
for i in range (n):
c = i + n
print(c)
print(“End of for() loop”)
Answers
Answer:
your question is wrong
Explanation:
pls check it thankyou
Answer:
Computers are often used to automate repetitive tasks. Repeating identical or similar tasks without making errors is something that computers do well and people do poorly.
Repeated execution of a set of statements is called iteration. Because iteration is so common, Python provides several language features to make it easier. We’ve already seen the for statement in chapter 3. This the the form of iteration you’ll likely be using most often. But in this chapter we’ve going to look at the while statement — another way to have your program do iteration, useful in slightly different circumstances.
Before we do that, let’s just review a few ideas...
7.1. Assignment
As we have mentioned previously, it is legal to make more than one assignment to the same variable. A new assignment makes an existing variable refer to a new value (and stop referring to the old value).
1
2
3
4
airtime_remaining = 15
print(airtime_remaining)
airtime_remaining = 7
print(airtime_remaining)