





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Answer: division, always results in float โ //. Answer: division, always results in integer โ =. Answer: assignment operator โ +=. Answer: reassignment operator, adds โ - =. Answer: reassignment operator, subtracts โ *=. Answer: reassignment operator, multiples
Answer: reassignment operator, divides โ <. Answer: less than โ >. Answer: greater than โ <=. Answer: less than or equal to โ >=. Answer: greater than or equal to โ ==. Answer: equal to โ !=. Answer: not equal to
โ return. Answer: defines output of a function โ if age < 16:. Answer: creates an if statement โ else:. Answer: else statement, used in conjunction with if statement or if/elif statement โ elif age >= 16 and age <= 18:. Answer: elif statement, used in conjunction with if statement โ True and False. Answer: False: and operation will always be false unless both sides are true โ True or False. Answer: True: or operation will always be true unless both sides are false โ not(True and False).
Answer: True: Boolean not operation will produce the inverse value. โ myNumbers = [1, 4.8, 7, 9.2, 3, 0]. Answer: creates a list โ mylist[0]. Answer: accesses first element from a list โ mylist[-1]. Answer: accesses last element from a list โ mylist[1:3]. Answer: slices list including second and third element โ mylist[:3]. Answer: slices list beginning with first element and including through the third element. Index position 3 is not included in selection. โ mylist[3:]. Answer: slices list beginning with fourth element and include remainder of the list
โ sum(). Answer: returns total sum of list values โ append(). Answer: adds new value to end of list โ pop(). Answer: removes last item from a list โ pop(1). Answer: removes second item from a list โ join(). Answer: joins values from a list using a defined separator โ set(). Answer: creates a set, or a list that contains unique items โ add(). Answer: adds value to set โ discard().
Answer: removes value from set, if found โ for city in cities:. Answer: iterates over items within a list โ range(). Answer: defines a range of numbers โ while temp >= 32:. Answer: iterates a set of commands as long as the condition remains true, stopping when the condition becomes false โ break. Answer: loop command that stops iteration prematurely โ studentGrades = { 'Orfu': 83, 'Bismark': 98, 'Igor': 72}. Answer: entries are added in key/value pairs โ if 'key' in dictionary:. Answer: verifies if key exists in dictionary โ get().