04 Flashcards
What are the two ways a programmer interacts with python?
Through the command line or by saving the source code to a file and instructing python to run the file
What is the first line you enter for a python script?
!/usr/bin/env python
A __________ is a named memory space used to store, access, and manipulate a variety of data objects.
variable
Python is dynamically typed T/F?
True
Python
__________ returns the data type of the obejct passed
___________ Exits the Python script and returns the exit status of the terminal
_________ Displays the help page from the Python Documents
_________ Returns the number of elements in a container, like a list or string
__________ Displays a list of all avaliable methods for the object passed
type(>object>)
exit(>object>)
help(>object>)
len(>object>)
dir(>object>)
What is the order of operations in Python?
PEMDRAS
Parenthesis, Exponents, Multiplication, Division, Remainder, Addition, Subtraction
The ______ function in python prompts the user for input and then prints ti to the screen
input()
____________ enables the programmer to change the data type to the desired operator
typecasting
Python
_____________ Attempts to convert the provided object into a string
_____________ Attemp[ts to convert the provided object into an integer
_____________ Attempts to convert the provided object into a float
_____________ Returns a sequenced list of elements from the iterable object passed
satr(>object>)
int(>object>)
float(>object>)
list(>object>)
The ______ stores an array of objects
They can store any type of data T/F?
list
True
Python
____________ appends an object to the end of a list
____________ removes the first element from the list specified by the obejct value
____________ Delete an element via index position
___________ sorts all the items and updates the list at the same time
______________ returns the index position of the first item located within the list equal to the object value
(tells you where something is in a list
list.append(>object>)
list.remove(>object>)
list.pop(>index>)
list.sort()
list.index(>object>)
Python
_________ returns a copy of the string with each letter capitalized
_________ returns a copy of the string with each letter in lowercase
_________ Returns the first index position where the substring is found. Return -1 if the substring is not found
__________ Returns the string as a list of delimited by the value passed as an argument, with a default of a whitespace.
__________ Returns a string composed of each item in the list concatinated by string
__________ Returns the string with leading and trailing chars removed; default is whitespace characters
string.upper()
string.lower()
string.find(<substring>)</substring>
string.split()
string.join(<list>)</list>
string.strip([chars])
How do I make it so my python string can contain variables?
f literal
The ___________ is the backslash charcter (). The escape charcter adds or removes meaning to or from the immediately follwing character
escape character
Pythons ________ function send information to the monitor