Python Programming Test

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

True/False: A better way to repeatedly perform an operation is to write the statements for the task once, and then place the statements in a loop that will repeat the statements as many times as necessary.

True

True/False: Both of the following for clauses would generate the same number of loop iterations: 'for num in range(4):' for num in range(1,5):

True

True/False: Computer programs typically perform three steps: Input is received, some process is performed on the input, and output is produced.

True

True/False: In Python, print statements written on separate lines do not necessarily output on separate lines.

True

True/False: Python allows programmers to break a statement into multiple lines.

True

variables can be reassigned?

True

Count-controlled loop

What type of loop structure repeats the code a specific number of times.

The line continuation character is a _____.

\

turtle.pencolor('blue')

changes the color drawn to blue

turtle.fillcolor('green')

changes the color used for filling shapes to green

turtle.heading(90)

changes the heading of the turtle to north or up

turtle.shape('turtle')

changes the shape of the turtle to a turtle

str

converts to a string

keyword

define the language's syntax rules and structure, and they cannot be used as variable names

statement

instruction that the Python interpreter can execute

integer vs. float

integer is a number w/out a decimal; float is a number with a decimal

The Python _______________ is a program that can read Python programming statements and execute them.

interpreter or console

turtle.penup()

lifts the pen to stop drawing

The % symbol is the remainder operator and it is also known as the _______________ operator.

modulus

turtle.forward(50)

moves a turtle forward 50 units

turtle.dot()

places a dot on the screen

turtle.stamp()

puts a stamp down in the current shape

turtle.pendown()

puts the pen down so the turtle can draw

turtle.left(25)

turns a turtle left 25 degrees

A(n) _______________ is a name that represents a value stored in the computer's memory.

variable

Which mathematical operator is used to raise five to the second power in Python?

**

+, -, *, /

Python operators that perform mathematical operations.

Python

A modern programming language named after Monty Python

What will the statement 'for num in range(2, 9, 2)' produce

2, 4, 6, 8

int

A Python data type that holds positive and negative whole numbers

float

A Python data type which stores floating-point numbers. Floating-point numbers are stored internally in two parts: a base and an exponent. When printed in the standard format, they look like decimal numbers

block

A group of consecutive statements with the same indentation.

algorithm

A set of specific steps for solving a category of problems

Statement:

A single line of Python code.

for loops

"for x in list_name" ... applies something to every item in a list

True/False: According to the behavior of integer division, when an integer is divided by an integer, the result will be a float.

False

True/False: Python formats all floating-point numbers to two decimal places when outputting using the print statement.

False

modulus operator

%, works on integers (and integer expressions) and gives the remainder when the first number is divided by the second

for num in range(4):

0, 1, 2, 3

If value1 is 2.0 and value2 is 12, what is the output of the following command? print(value1 * value2)

24.0

After the execution of the following statement, the variable price will reference the value _____. price = int(68.549)

68

When applying the .3f formatting specifier to the following number, 76.15854, the result is _______________.

76.159

function

A named sequence of statements that performs some useful operation.

integer division

An operation that divides one integer by another and yields an integer.

When the + operator is used with two strings, it performs string _______________.

Concatenation

def

Defines a function

The output of the following print statement is: print ('I\'m ready to begin')

I'm ready to begin

PEMDAS

Order of operations that Python follows

What symbol is used to mark the beginning and end of a string?

Quotation

iteration

To repeat a section of code.

evaluate

To simplify an expression by performing the operations in order to yield a single value.

The _____ built-in function is used to read a number that has been typed on the keyboard.

input()

After the execution of the following statement, the variable sold will reference the numeric literal value as a(n) _____ data type: sold = 256.752

float

indentations in python

mean that there is a code block

operators

special tokens that represent computations like addition, multiplication and division

for

the Python keyword that proceeds a block of code to loop through a series of statements.


Ensembles d'études connexes

Li Na Chen Part 1 vSim (Post-Sim Quiz)

View Set

English Praxis II Famous Quotes and Novels

View Set

Entrepreneurship Chapter 2 Review

View Set