All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
automate the boring stuff with python
Questions and Answers of
Automate the Boring Stuff with Python
What do you do if your code gets an error message that says got more than 10000 bytes?
The imapclient module handles connecting to an IMAP server and finding emails. What is one module that handles reading the emails that imapclient collects?
What three pieces of information do you need from Twilio before you can send text messages?
What is an RGBA value?
How can you get the RGBA value of 'CornflowerBlue' from the Pillow module?
What is a box tuple?
What function returns an Image object for, say, an image file named zophie.png?
What is a relative path relative to?
What does an absolute path start with?
What do the os.getcwd() and os.chdir() functions do
What are the . and .. folders?
In C:\bacon\eggs\spam.txt, which part is the dir name, and which part is the base name?
What are the three “mode” arguments that can be passed to the open() function?
What happens if an existing file is opened in write mode?
What is the difference between the read() and readlines() methods?
What data structure does a shelf value resemble?
Which of the following are operators, and which are values?*'hello'-88.8-/+5
Which of the following is a variable, and which is a string?spam'spam'
Name three data types.
What is an expression made up of? What do all expressions do?
This chapter introduced assignment statements, like spam = 10. What is the difference between an expression and a statement?
What does the variable bacon contain after the following code runs?bacon = 20bacon + 1
What should the following two expressions evaluate to?'spam' + 'spamspam''spam' * 3
Why is eggs a valid variable name while 100 is invalid?
What three functions can be used to get the integer, floating-point number, or string version of a value?
Why does this expression cause an error? How can you fix it?'I have eaten ' + 99 + ' burritos.'
What are the two values of the Boolean data type? How do you write them?
What are the three Boolean operators?
Write out the truth tables of each Boolean operator (that is, every possible combination of Boolean values for the operator and what they evaluate to).
What do the following expressions evaluate to?(5 > 4) and (3 == 5)not (5 > 4)(5 > 4) or (3 == 5)not ((5 > 4) or (3 == 5))(True and True) and (True == False)(not False) or (not True)
What are the six comparison operators?
What is the difference between the equal to operator and the assignment operator?
Explain what a condition is and where you would use one.
Identify the three blocks in this code:spam = 0if spam == 10:print('eggs')if spam > 5:print('bacon')else:print('ham')print('spam')print('spam')
Write code that prints Hello if 1 is stored in spam, prints Howdy if 2 is stored in spam, and prints Greetings! if anything else is stored in spam.
What can you press if your program is stuck in an infinite loop?
What is the difference between break and continue?
What is the difference between range(10), range(0, 10), and range(0, 10, 1) in a for loop?
Write a short program that prints the numbers 1 to 10 using a for loop. Then write an equivalent program that prints the numbers 1 to 10 using a while loop.
If you had a function named bacon() inside a module named spam, how would you call it after importing spam?
Why are functions advantageous to have in your programs?
When does the code in a function execute: when the function is defined or when the function is called?
What statement creates a function?
What is the difference between a function and a function call?
How many global scopes are there in a Python program? How many local scopes?
What happens to variables in a local scope when the function call returns?
What is a return value? Can a return value be part of an expression?
If a function does not have a return statement, what is the return value of a call to that function?
How can you force a variable in a function to refer to the global variable?
What is the data type of None?
What does the import areallyourpetsnamederic statement do?
If you had a function named bacon() in a module named spam, how would you call it after importing spam?
How can you prevent a program from crashing when it gets an error?
What goes in the try clause? What goes in the except clause?
How would you assign the value 'hello' as the third value in a list stored in a variable named spam? (Assume spam contains [2, 4, 6, 8, 10].) For the following three questions, let’s say spam
What does spam[int('3' * 2) / 11] evaluate to?
What does spam[-1] evaluate to?
What does spam[:2] evaluate to? For the following three questions, let’s say bacon contains the list [3.14, 'cat', 11, 'cat', True].
What does bacon.index('cat') evaluate to?
What does bacon.append(99) make the list value in bacon look like?
What does bacon.remove('cat') make the list value in bacon look like?
What are the operators for list concatenation and list replication?
What is the difference between the append() and insert() list methods?
What are two ways to remove values from a list?
Name a few ways that list values are similar to string values.
How do you type the tuple value that has just the integer value 42 in it?
How can you get the tuple form of a list value? How can you get the list form of a tuple value?
Variables that “contain” list values don’t actually contain lists directly. What do they contain instead?
What is the difference between copy.copy() and copy.deepcopy()?
What does the code for an empty dictionary look like?
What does a dictionary value with a key 'foo' and a value 42 look like?
What is the main difference between a dictionary and a list?
What happens if you try to access spam['foo'] if spam is {'bar': 100}?
If a dictionary is stored in spam, what is the difference between the expressions 'cat' in spam and 'cat' in spam.keys()?
How would you write a regex that matches a sentence where the first word is either Alice, Bob, or Carol; the second word is either eats, pets, or throws; the third word is apples, cats, or baseballs;
If a dictionary is stored in spam, what is the difference between the expressions 'cat' in spam and 'cat' in spam.values()?
What is a shortcut for the following code?if 'color' not in spam:spam['color'] = 'black'
What module and function can be used to “pretty print” dictionary values?
What do the and \t escape characters represent?
How can you put a \ backslash character in a string?
The string value "Howl's Moving Castle" is a valid string. Why isn’t it a problem that the single quote character in the word Howl's isn’t escaped?
If you don’t want to put in your string, how can you write a string with newlines in it?
What do the following expressions evaluate to?• 'Hello world!'[1]• 'Hello world!'[0:5]• 'Hello world!'[:5]• 'Hello world!'[3:]
What do the following expressions evaluate to?• 'Hello'.upper()• 'Hello'.upper().isupper()• 'Hello'.upper().lower()
What do the following expressions evaluate to?• 'Remember, remember, the fifth of November.'.split()• '-'.join('There can be only one.'.split())
What string methods can you use to right-justify, left-justify, and center a string?
How can you trim whitespace characters from the beginning or end of a string?
What is the function that creates Regex objects?
Why are raw strings often used when creating Regex objects?
What does the search() method return?
How do you get the actual strings that match the pattern from a Match object?
In the regex created from r'(\d\d\d)-(\d\d\d-\d\d\d\d)', what does group 0 cover? Group 1? Group 2?
Parentheses and periods have specific meanings in regular expression syntax. How would you specify that you want a regex to match actual parentheses and period characters?
The findall() method returns a list of strings or a list of tuples of strings. What makes it return one or the other?
What does the | character signify in regular expressions?
What two things does the ? character signify in regular expressions?
What is the difference between the + and * characters in regular expressions?
What is the difference between {3} and {3,5} in regular expressions?
What do the \d, \w, and \s shorthand character classes signify in regular expressions?
What do the \D, \W, and \S shorthand character classes signify in regular expressions?
Showing 100 - 200
of 207
1
2
3