lecture 20 debugging pt 2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

breakpoints

set on a specific line of code and forces the debugger to pause whenever the program execution reaches that line

2
New cards

write an assert statement that triggers an AssertionError if the variable spam is an integer less than 10

assert spam >= 10, ‘the spam variable is less than 10.’

3
New cards

write an assert statement that triggers an AssertionError if the variables eggs and bacon contain strings that are the same as each other, even if their cases are different(that is, ‘hello’ and ‘hello’ are considered the same, and ‘ goodbye’ an ‘GOODbye’ are also considered the same)

assert eggs.lower() != bacon.lower() ‘The eggs and bacon variables are the same!’ or assert eggs.upper() != bacon.upper(), ‘The eggs and bacon variables are the same!’

4
New cards

write an assert statement that always triggers an AssertionError

assert False, ‘This assertion always triggers.’

5
New cards

what are the two lines that you program must have in order to be able to call logging.debug()?

import logging

logging.basicConfig(level=logging.DEBUG, format =’ %(asctime)s - %(levelname)s - %(message)s’)

6
New cards

what are the five logging levels?

DEBUG, INFO, WARNING, ERROR, and CRITICAL

7
New cards

what line of code can you add to disable all logging messages in your program?

logging.disable(logging.CRITICAL)

8
New cards

why is using logging messages better than using print() to display the same message?

-you can disable logging messages w/o removing the logging function calls

-you can selectively disable lower-level logging messages

-you can create logging messages

-logging messages provides a timestamp

9
New cards

what is a breakpoint

setting on a line of code that causes the debugger to pause when the program execution reaches the line

10
New cards

web scraping

using a program to download and process content from the web

11
New cards

webbrowser logging module

comes w/ python and opens a browser to a specific page

12
New cards

requests logging module

downloads files and web pages from the internet

13
New cards

bs4 logging module

parses HTML, the format that web pages are written in

14
New cards

selenium logging module

launches and control a web browser

15
New cards

webbrowser.open() functoin

launch a new browser to a specified URL