AE1205 Programming Python Quiz: so how do we generate Numbers 1 to 10? range( ) Numbers 5,10,15,20,25 to 100? range( ) Numbers 20,18,16, to 0? range( ) 1
AE1205 Programming Python Quiz: so how do we generate Numbers 1 to 10? range(1,11) Numbers 5,10,15,20,25 to 100? range( ) Numbers 20,18,16, to 0? range( ) 2
AE1205 Programming Python Quiz: so how do we generate Numbers 1 to 10? range(1,11) Numbers 5,10,15,20,25 to 100? range(5,105,5) or range(5,101,5) Numbers 20,18,16, to 0? range( ) 3
AE1205 Programming Python Quiz: so how do we generate Numbers 1 to 10? range(1,11) Numbers 5,10,15,20,25 to 100? range(5,105,5) or range(5,101,5) Numbers 20,18,16, to 0? range(20,-2,-2) 4
AE1205 Programming Python Quiz: What will this print? print sum(range(1,11)) 5
AE1205 Programming Python Quiz: What will this print? print sum(range(1,11))
AE1205 Programming Python Quiz: What will this print? print sum(range(1,11)) Dus 10*11/2 = 55 So what does this print? print sum(range(1,101))
AE1205 Programming Python Quiz: What will this print? print sum(range(1,11)) Dus 10*11/2 = 55 So what does this print? print sum(range(1,101)) 5050
AE1205 Programming Python Quiz: what will this print? s=0 for x in range(3): for y in range(3): s = s + 1 print x,y print s,x,y Check 9 Answer: This is called: nested loops
AE1205 Programming Python Quiz: What will this print? x = 0. while x+5 > x*x: print x x = x
AE1205 Programming Python Quiz: What will this print? x = 0. while x+5 > x*x: print x x = x
AE1205 Programming Python Quiz: What will this print? x = 0. while x+5 > x*x: print x x = x
AE1205 Programming Python Quiz: What will this print? x = 0. while x+5 > x*x: print x x = x + 1. >>>