






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: integer โ 1.2. Answer: float โ 'twelve'. Answer: string โ "twelve". Answer: string โ True or False. Answer: Boolean value โ type(). Answer: determines type of an object (integer, boolean, etc)
โ int(). Answer: converts to integer object โ float(). Answer: converts to float object โ str(). Answer: converts to string object โ print(). Answer: displays a message โ +. Answer: addition (integer) or concatenation (string) โ -. Answer: subtraction โ **. Answer: power of โ %.
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 โ len(). Answer: returns length
โ title(). Answer: capitalizes first letter of each word โ islower(). Answer: determines if the string consists of lowercase characters โ count(). Answer: totals number of times an argument is found within a predefined value โ format(). Answer: inserts variable data in a string โ def. Answer: keyword used to create functions โ def myfunction():. Answer: syntax for function declaration โ return. Answer: defines output of a function
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 โ 9.2 in myNumbers. Answer: looks for a match and returns Boolean value
โ 9.2 not in myNumbers. Answer: ensures a match does not exist in list โ len(). Answer: counts items in list โ max(). Answer: returns greatest element of list โ min(). Answer: returns smallest element of list โ sorted(). Answer: returns copy of list ordered smallest to largest โ sorted(listname, reverse=True). Answer: returns copy of list ordered largest to smallest โ sum(). Answer: returns total sum of list values
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(). Answer: looks up value by key โ myPhone = (877, 435, 7948).
Answer: creates a tuple โ open('/my_path/my_file.txt','r'). Answer: opens a file object for reading โ open('/my_path/my_file.txt','w'). Answer: opens a file object for writing โ read(). Answer: reads data from open file โ close(). Answer: closes open file โ write(). Answer: writes to open file โ with open('/my_path/my_file.txt','r') as f:. Answer: opens a file, performs operations and automatically closes file โ import math.