Programming Final

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

len

Dictionaries have pairs; Use the ___ function to determine how many pairs are in the dictionary.

function

A __ can be described simply as a mini-program that goes off and performs a specific task.

for

A ___ loop is used to iterate through a sequence.

statement

A ____ is a complete instruction in Python.

iterates

A for loop ____ over a sequence one element at a time.

condition

All if statements have a _____ which is an expression that evaluated to either true or false.

0

All sequences start at index ___.

condition colon block

An if statement is built by using an if followed by a ____, a ____, and ___ of one or more statements.

right left

Assignment Statements take what's on the ___ and assign it to the variable on the ___. (Left/Right)

immutable

Both strings and tuples cannot change. They are ____

data operators

Concatenate, add, subtract, multiply, divide, and mod, are all ___

sequence

Strings and tuples are both this kind of data:

any

Strings can only contain characters, but tuples can contain ___ type.

data types

Strings, integers and floats are ___.

comparison

The == is a ____ operator.

>>>

The IDLE command prompt is ___.

string literals

The ____ data type consists of characters enclosed in quotes.

modules

The import statement allows the programmer to import _____ which contain code that can be used in any Python program.

%

The modulus operator, does division and returns the integer

\n

print a newline

\\

prints a backslash

\"

prints a double quote

\t

prints a horizontal tab

\'

prints a single quote

floating-point

numbers with decimals

initialize check change

Name the 3 things that must occur for a sentry variable to effectively control the while loop:

keys values

Python dictionaries use ___ instead of indices to get to ___ saved in the dictionary.

case-senstive

Python differentiates between upper and lower case letters so that 'print' and 'PRINT' are not the same. This is called _____.

cross-platform

Python is able to run on many different operating systems like Windows, Mac & Linux and a program created on any of these can run on the others. This is called ____.

syntax highlighting

Python uses ____ so that special words that are a part of the Python language are colored purple and strings are always green.

tuples

Tuples can only be concatenated with ___.

.title

method that capitalizes the first letter of each word

.capitalize

method that capitalizes the first letter, and the rest lowercase

.swapcase

method that changes the cases of a string

.lower

method that makes a string lower case

.upper

method that makes a string upper case

.strip

method that returns a string with no whitespace at the beginning or end

.replace(old,new)

method that returns all of one old word of a string, with a new one

iterates

a for loop ___ over the elements of the list one at a time.

==

equal to

!=

not equal to

types

10>"five" will not work because objects of different ____ cannot be compared.

Integrated Development Environment

IDLE is the ___ for Python.

mutable

Lists are like tuples except that they are ____. (can be changed)

indexes

Lists use ____ to access a single element of the list.

.append

Lists use the ____ method to add a new element at the end of the list.

randint() and randrange()

Name 2 functions used to generate random numbers:

and or not

Name the 3 boolean operators:

strings tuples lists

Name the 3 kinds of sequences:

Interactive and Script Mode

The two modes of IDLE are ___ and ___.

syntax, runtime, logic

Three types of errors:

len( )

To find the size of a tuple or string use the ____ function.

escape sequence

To print quotes inside of a string, use an ____ to make Python ignore them.

len

Use the ___ function to determine how many elements are in the list.

range

Use the ___ function with a for loop to count forwards or backwards.

in

Use the ___ operator to see if an element is a member of a dictionary.

in

Use the ___ operator to see if an element is a member of a sequence.

Int

Use the ____ function to convert a string to an integer.

triple quotes

Used so that the string is printed exactly how it was typed.

*

Used to repeat strings

concatenate strings

Using the plus sign (+) to put strings together is called _____.

arguments

Values that are passed to functions are called _ ___.

data

Variables are containers in memory used to store ____.

numbers letters underscores

Variables can only contain ___ ___ and ___.

reserved word

Variables cannot be a ___ ___.

elif

When one or more ___ are added to the if statement, a sequence of conditions can be evaluated.

true block

While the condition of a while loop evaluates to ___, the ___ is executed.

integers

Whole numbers

escape sequences

\' \" \\ \n \t are all called ___.

strings

___ are a series of characters

methods

___ are called through (attached to) a string

constants

___ are variables that aren't supposed to change; they are usually all uppercase.

data

___ is information used in a program. Python has different types of __(same word).

!=

___ is used to check if two things are "not equal"

modules

___ must be specifically brought into the program before you can use the code in them.

input

____ Is a function that is used to get information from the user.

indexing

____ allows you to specify a position number in a string or tuple and access the element at that position.

methods

____ are similar to functions, but cannot be called on their own; they must be passed through a particular object like a string.

string literals

____ are strings enclosed in quotes

indentation

____ is used to create visual and logical blocks of code.

branching

____ means making a decision to take one path or another

variables

containers to hold data are called ____.

int()

converts a string number to an integer

str()

converts an integers and returns it as a string

float()

converts the number to a floating point number

nested

ducks=["Daffy",[Donald", "Daisy"], [Huey, Dewey, Louie]] is an example of a ___ lists.

>

greater than

>=

greater than or equal to

<

less than

<=

less than or equal to

\a

sounds the system bell

assignment

the = is the ____ symbol.

del

the __ function removes an element of a list based on its location.

remove

the ___ method removes an element based on its value.

module

the import statement allows the programmer to import a ____ which contains code that can be used in any Python program.

//

used for integer division, truncates (doesn't round)

/

used for true division

condition operators

used to make a comparison, using objects of the same type

number

variables cannot start with a ___.

sentry variable

while loops are controlled by a ______


Ensembles d'études connexes

Study Guide- Introduction and Part 1

View Set

EAQ N4510 Respiratory Summer '20

View Set

Quiz 9 Consumer's and Producer's Surplus

View Set

Kantor Pos - Leçon 5 (Ibu Chandra)

View Set

Washington Life and Health (Disability)

View Set