Here are some problems for you to try. These questions make good quiz and exam prep. They were originally written by grade 11 students in a Java course. Julian D. rewrote them in Python.
This style of question will be on the first half of the exam. To prepare for the second half, review the exam page.
#ICS3C Python Assessment 1###NAME:_________________________#Provide all output.pearl = Falsejam = Truex = 10y = 15 print(pearl)print(jam) if(pearl == True): print(x)else: print(y) pearl = jam if(pearl == True): print(-x)else: print(-y) if(jam != pearl): x = 1elif(pearl != jam): x = 2else: jam = True print(jam)print(x)#ICS3C Python Assessment 2###NAME:_________________________#Provide all output.q = 0r = 0 #print(q)flag = False for x in range(0, 5): flag = False print(x) flag = Trueprint(flag) while q <= 3: print('A') print(q) q+=1 while(q <= 3): print('B') print(q) q+=1while flag == False: print(flag) flag = True print('hip')while flag == True: print(flag) flag = False print('hop')
#ICS3C Python Assessment 3###NAME:_________________________#Provide all output.for dog in range(0,2): print('OUT') print(dog) for cat in range(0,2): print('In') print(cat) #print('DONE')#ICS3C Python Assessment 3v2_MAKEUP###NAME:_________________________#Provide all output.for x in range(0,2): print('OUT') print(x) for y in range(0,2): print('In') print(y) #print('DONE')#ICS3C Python Assessment 4###NAME:_________________________#Provide all output.for i in range(3): print(i)print('swing')for i in range(3, 0, -1): print(i)print('swing')for i in range(0, 6, 2): print(i)#ICS3C Python Assessment 5###NAME:_________________________#Provide all output.q = 0flag = Falsej = 0for i in range(0,3): print('woo '+ str(i)) flag = True q+=1print('hoo ' + str(q))print('boo ' + str(j))for u in range(q): print('doo '+ str(u)) if((u % 2 == 0) and (flag == True)): print('goo ' + str(j)) print('moo ' + str(i))#ICS3C Python Assessment 6###NAME:_________________________#Provide all output.def foo(): print('light')def returnOfTheJedi(x): return xdef neatO(ii): ii = ii + 1 return iidef thisWasNotPartOfThePlan(): haa = 1 foo() return haa def baa(ee): print(ee)def areYouSure(): return Falsedef meThinksNot(ff): ff = True return Falsedef doo(xx, yy): print(yy + xx)def order66(cc): padawan = cc - 9999 return padawan def goo(x): print(x) x = '5'baa('saber')foo()goo(x)goo(5)returnOfTheJedi('Luke')jedi = returnOfTheJedi('Luke')goo(jedi)doo(jedi, x)q = thisWasNotPartOfThePlan()if q == 1: x = 'bulb' b = order66(10000)else: x = 'box' b = order66(10001)goo(x)goo(b)for counter in range(1,5): jj = neatO(counter) goo(jj)problems = areYouSure()print('Is Luke a jedi? ' + str(problems))problems = meThinksNot(True)print('Is anyone Luke trains, a jedi? ' + str(problems))print('How many Jedi are left? ' + str(b))##test.py#a = 'print'b = 1x = 3boo = Truewhile b < 3: b += 1 for z in range(x): print(z)print('b ' + '= ' + str(b))if a == 'PRINT': print('Potato') boo = Falsea = 'MOO'if a == 'MOO': print('B')print(boo)##student_quiz.py#s = 'blah'a = 0b = 1c = 3for x in range(4): print(x) print(b) a = a + xwhile c > 0: c -= 1 print(c) b = a + c print(b) print(s) for x in range(5, -1, -1): print(x) if x == 5: print(b + x) elif x== 4: print('P +' + str(c)) elif x==3: print('Nothing prints here at all') elif x==2: print(a + b + c) else: print(str(x + a + b + c) + s) print('All done now.')##sample_quiz001.py#x = 3y = 5jah = Falseoink = 'moo'while x > 0: print('M' + str(x)) x -= 1 y += 1while jah: print('We like to party.')cowArray = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]while y > 0: print(str(cowArray[y]) + ' cows in the pasture.') q = 0 while q < y: print(oink) y -= 1 q += 1 y -= 1##riddled_walkthrough.py#alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']alpha = 'abcdefghijklmnopqrstuvwxyz'guess = ''answer = 0count = 0x = 0print('Riddle: \nWhat is at the beginning of the end, but at the end of time & space?')answer = len(alpha)answer = answer + 1answer = answer % 2answer = answer * 6answer = 5 ^ answeranswer = int(answer / 25)answer = answer % 5answer = answer + 4 x = answerwhile count < 99: if count == x: guess = alphabet[x] count = 100 else: count += 1 print('What is your guess? \n' + guess)print('Is that your final answer?')if guess == 'E': print('No')elif guess == 'E' or guess == 'e': print('Yes')else: print('I do not know')if guess == 'e': print('Gz you solved the riddle!')else: print('You are still Green! Keep practicing! >;)')##quiz1.py#x = 4y = 2z = 1names = ['Bob', 'Bill', 'Joe', 'Moe', 'Hank']print(x)print(y)z += 1x = y - zprint(x)for count in range(5): print(count) y += 1 print(y)print(names[0]) print(names[2])print(names[4])if y == x: names[1] = 'Jim'else: names[0] = 'George'print(names[0]) print(names[1])print(names[2])print(names[3]) print(names[4])print(y)##quiz_sand_g.py#a = 0b = 1c = 2d = 3boo = 'b'flag = Trueprint('One: ' + str(b), end = '')print(' Two: ' + str(c), end = '')print(' Three: ' + str(d), end = '')print()print(boo)if flag == False: print(boo) print(boo)if flag != False: a = c + d print(a)for foo in range(d): print('You') for woo in range(2): print('Rock')while flag != False: a = a + a print(a) print(boo) flag = Falsewhile c > 0: print('Good') for moo in range(2, 0, -1): print('Luck') c -= 1##quiz.py#x = 0.0y = 0a = 0a += 1x += 1z = 6d = z - ablah = 'bob'flag = Falseprint('x')george = []for q in range(z): george.append(0)for p in range(d): george[a] = p a += 1 flag = True while flag: print(blah + str(a)) flag = False print(george[y])george[y] += 1print(george[y])y += 1print(y)print(x)x -= 1print('[', end = '')for p in range(z): print(george[p], end = '') if d > p: print(',', end = '')print(']')##python_array_quiz.py#lantern = [False, False, False]hextech = 0piano = 0violin = 0while piano < 2: piano += 1 # print('piano')while hextech < 3: print(hextech) hextech += 1print(piano, end = '')while violin < 2: if piano < 3: lantern[violin] = True else: lantern[violin] = False print(lantern[violin]) violin += 1 piano += 1 while hextech > 0: print('^cake') hextech -= 1 hextech += 1 print('This is the 12th line printed.')##exam_printactice_test.py#x = 0y = 0z = 0n = Trues = 'Hi'print (y)for w in range(5): print (w) y += 1 print (y)while n == True: if x == 0: print (s) x += 1 #print (x) if z < 4: z += 1 print (z) if z == 4: n = False print (s)##evil_quiz.py#apple = [1, 2, 3, 4, 6, 9, 54]pear = 0peach = 2orange = ''banana = '!'celery = ['Yes.', 'NO', 'No!', 'no', 'OK', 'fun']cheese = Falsebread = Trueprint('banana', end = '')print(banana)for counter_1 in range(0, 5, 2): print(str(apple[counter_1]) + orange) counter_1 += 1 print(peach) peach += 1 print(peach)print('This is where the fun starts')if cheese != False: print('Or is it?') for counter_2 in range(-5, 2, -1): print(counter_2) #print(counter_2) else: print('Yes, yes it is ' + str(apple[5]))for counter_3 in range (4, -1, -1): print(celery[counter_3]) if counter_3 == 0: bread = False else: print('Is it ' + celery[5] + ' yet?') print('celery[2]')if celery[5] == 'FUN': print(cheese)else: print('I probably failed this quiz')##course_quiz.py#hipster = 'mainstream'you = ''counter = 0countar = 0kewl = 20snoopdawg = 98357einstein = [150, 93, 15, 12, 6]you = 'you'for countah in range(5): print(einstein[countah]) #print('yourmom')for count in range(5): while counter < 100: print(str(count) + ',', end = '') counter = counter + 10 countar = count #snoopdawg = 5 print('\nHipterz r so' + hipster, end = '') counter = 90while snoopdawg == 98357: snoopdawg = int(kewl / 2) snoopdawg = kewl + countar print('\n' + str(snoopdawg)) hipster = 'dog' snoopdawg += 1print('hipster')print(you)##bird_loop.py#counter = 0num = 0test = [1, 3, 5, 7, 2, 6, 1, 0]for count in range(5): while counter < 100: print(str(count) + ',', end = '') counter = counter + 10 print (str(counter) + (' ? ')) counter = 0for count in range(20): print (test[num]) num = (test[num]) print(num, end = '')##beat_box_test.py#a = 0b = 0boo = TrueawesomeArray = ['ch', 'Whap', 'Bmph', 'Whicka', 'Bap', 'ah', 'waw', 'duduh', 'neeo']x = 8while x > a: a += 2 print(awesomeArray[a]) print(awesomeArray[x]) x -= 1 y = 3 while y < 0: y -= 1 print(awesomeArray[0]) for z in range(20, 21, -1): print(awesomeArray[1]) x -= 1 for z in range(1, 4): print(awesomeArray[4])##barn_animal_test.py#pig = 'cow'cow = 'chicken'chicken = 'farmer'farmer = 'pig'barnYard = []for i in range(100): barnYard.append('')for set1 in range(99, 0, -1): barnYard[set1] = 'null'print('Welcome to the barnyard')if farmer == 'PIG' or farmer == 'pig': print(pig)if farmer == 'PIG': print(cow)if farmer == 'PIG' or farmer == 'pig': print(farmer)if farmer == 'PIG ' or farmer == 'pig ': print(chicken)for x in range(10, 11): barnYard[37] = 'corn'farmer = 'farmerJoe'chicken = 'leanardo'cow = 'frank'pig = 'piggy'barnYard[96] = 'birth of a platypus'print('farmer name is' + ': ' + farmer + '\nand the chicken is nammed' + ' :' + ' ' + chicken + '.\n', end = '')for water in range(0, -3, -1): print(water) for grass in range(3): print('Grass') for hay in range(1, 0, -1): print(barnYard[5]) print('\nDont eat my chickens wings') x = 99while x > 20: barnYard[x] = 'harvest' x = x - 10 print('barnYard @ 49 = ' + barnYard[39])