Programming Language and Toolkits Python Crash Course

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The _____ executes code written in the Python programming language. IDE Jupyter notebook program Python interpreter

Python interpreter

In the code below, data is an example of a/an _____. scatterplot(data=hawks, x='wingLength', y='weight') argument function parameter return

parameter

{'yellow', 'red', 'green'} is an example of a/an _____. array list set tuple

set

What is the output? def modify(names, score): names.append('Montana') score = score + 20 players = ['Bailey', 'Taylor', 'Riley'] score = 150 modify(players, score) print(players, score) ['Bailey', 'Taylor', 'Riley'] 150 ['Bailey', 'Taylor', 'Riley'] 170 ['Bailey', 'Taylor', 'Riley', 'Montana'] 150 ['Bailey', 'Taylor', 'Riley', 'Montana'] 170

['Bailey', 'Taylor', 'Riley', 'Montana'] 150

Which code matches the following description best? Creates the list [10, 'abc']. Appends the value 7 to the end of the list Changes the second element in the list to 8.5. The final result is [10, 8.5, 7]. list = [10, 'abc'] list.append(7) list[1] = 8.5 list = [10, 'abc'] list[2]=7 list[1] = 8.5 list = [10, 'abc'] list.append(7) list[2] = 8.5 list = [10, 'abc'] list.add(7) list[1] = 8.5

list = [10, 'abc'] list.append(7) list[1] = 8.5

A container is _____ if an individual element can be changed. immutable indexed mutable ordered

mutable

Jupyter is convenient for testing, presenting, and sharing code, because ______ contain code, output, and text all in one place. documents notebooks scripts web pages

notebooks

A program that has source-code available for download and edit is _____. expensive backward compatible open source proprietary

open source

Python code that includes the keyword def is called a _____. function call function constructor function definition function reference

function definition

What is the output? LB_PER_KG = 2.2 def kgs_to_lbs(kilograms): pounds = kilograms * LB_PER_KG return pounds pounds = kgs_to_lbs(10) print(pounds) 22.0 No output: LB_PER_KG causes an error due to being outside any function No output: LB_PER_KG must be declared within kgs_to_lbs() No output: Variable pounds declared in two functions causes an error

22.0

What is the value of dict['fourth']? dict = { 'fifth': 1, 'fourth': 3, 'third': 4, 'second': 7, 'first' : 10} 1 3 4 7

3

What is the output? def print_app(app_id, plan='basic', term='30'): print('App: ' + app_id) print(plan + ' plan') print(term + ' days') print_app('10032', term='14') App: 10032 basic plan 14 days App: 10032 basic plan 30 days App: 10032 plan 14 days No output: the function call produces an error

App: 10032 basic plan 14 days

Which correctly calls the add() function? def add(a, b, c): return a + b + c add(2 4 6) add(2 + 4 + 6) add(2; 4; 6) add(2, 4, 6)

add(2, 4, 6)

Which of the following changes the value for the index 'third' to 5? dict = { 'fifth': 1, 'fourth': 3, 'third': 4, 'second': 7, 'first' : 10} dict['third']=5 dict[5]='third' dict['third':5] dict+{'third:5}

dict['third']=5


Kaugnay na mga set ng pag-aaral

AP Spanish IV - Tema 2 Comprensión

View Set

عواصم دول مجلس التعاون

View Set

Business Management 1 Objective 2.00

View Set

Chapter 9: Regional Economic Integration

View Set

Combo with A & P Blood and 1 other

View Set

Section 1: Sustainability & sustainable development

View Set

Test 3: Ch 52 Unintentional Injuries PrepU

View Set

A&P II Chapter 23: Digestive System (EXAM 4)

View Set