BIS115.
How many different repetition structures does Python support?
What are the major differences between them?
python supports 2 repetition structures.
repetition structures in the sense with in the block of code executed repeatedly.
1)condition controlled
2)count controlled
1)condition controlled in the sense while loop.
based on the condition while loop iterates.the while loop iterates until the condition must be satisfied.
ex:
i=0
while( i != 1):
print("hi")
#output:first here i initialize with 0 so later go to next statement while(0!=1):
so the condition is correct so enter into loop and print("hi") again go back to while(0!=1):
condition satisfied so again print "hi" so again go its prints infinity time there is no end.
so we must give condition when the while loop stops.if we want stop the loop we must add condition
satisfied.
ex: to stop the repetition
i=0
while( i != 1):
print("hi")
i=1
so we add one statement so first i=0 so enter into loop and print "hi" later statement i=1.
so i changes 0 to 1. so present i=1
while(1!=1):
its false so terminate the loop only output is "hi"
2)count controlled in the sense its based on the count.example for loop we give particular count the loop run.
ex:
for i in range(1,10,1):
print(i)
output:
1 2 3 4 5 6 7 8 9
for(start,end,increment):
for take 3 parameters first one where we start second where we end third one which kind of skip we need
for starting with 1 and ending number is 10 increment 1
first print 1
later increment 1
print 2
later increment 1
so print 2+1=3
so print 3
until we reach the 10.
when we i reaches 10 the loop terminates.
this is the for loop.
it wan count controlled
major difference is condition controlled terminates based on the condition
count controlled terminates based on the count.
#if you have any doubts comment below.if you like give thumsup...
BIS115. How many different repetition structures does Python support? What are the major differences between them?
How does a master budget relate to a flexible budget? What are the differences between them? How is each one used?
What are the major differences between Medicare, Medicaid, and CHIP? What is Medicare? Does the government fund it completely? How is the funding for Medicaid and CHIP different from the funding for Medicare? What are the four parts of Medicare and what do they cover, in general? Most Americans pay no premiums for Part A - why? What is meant by “prospective payment system,” and what part of Medicare does it affect?
What major differences are there between Scypha and Hydra body
forms? List and describe them.
scussion questions: 7. What major differences are there between Scypha and Hydra body forms? List and describe them.
In flowcharting, the repetition structure is different from the sequence and decision structures by having _____________. an arrow that points from bottom back to the top of the chart a diamond a parallelgram an arrow that points downwards towards the end How many times will the print statement be executed in the following code? i = 1 while i <= 5: j = 1 while j <= 5: print ('Hello') j = j + 1 i = i + 1...
What are some of the major differences between subculture and counterculture? Provide an example of each to support your answer.
Evaluate different logic gate families by showing similarities and differences between them.
What are the chief differences between these three data structures? How can you determine when it is appropriate to use a queue, a dequeue, or a priority queue?
what are the differences between personality structures and mental mechanisms ?
how are nucleic acid structures different from the structure of proteins? describe at leasr 3 differences
What are the chief differences between these three data structures? How can you determine when it is appropriate to use a queue, a dequeue, or a priority queue?