1/74
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
A practical difference between strings and integers is that
You can do math on integers but not strings
greeting = “hello world”
print(greeting[:4])
“hell”
In conditional testing using if statements, which keyword should be used to handle all the cases which do not match conditions being tested?
else
Which of the following creates a list
numbers = [1,2,3]
which of the following create a set
numbers = {1, 2, 3}
A set can have elements removed from it
True
movie = “ A New Hope”
movie[2:5]
numbers = [10,25,3,4]
for i in range(o,4):
print(_)
numbers[i]
a dictionary is meant for storing
a series of values, where each value is paired with a name or description
What is the correct syntax for defining a function in python
def functionName():
What is the difference between print() and return in a function
print() prints the output, while return sends a value back to the caller
by default, when looping through a dictionary, each item in a dictionary is a
key
[{5,6,7}, {8,9,10}]
The structure above is a
list of sets
An append method typically adds a value to
the end of list
What will the following code output
def my_function(x):
my_var = x*2
return my_var
answer = my_var(5)
print(answer)
10
What numbers would be generated by range (11,4,-3)
11,8,5
for i in range (50,10,10):
print(i,end= "")
what would the output be
No output
To test is a character is contained within a string, the best and easiest way to use the keyword
in
What numbers would be generated by range(7,13,2)
7,9,11
phrase = "AZ AR AK CO IL WA PA"
the function calls return a total of 3 elements
phrase.partition(" ")
state = "Pennsylvania"
which of the following will return the substring “Penn” in Python?
state[0:4]
person={"name": "John", "city":"Chicago")
to get a list containing "John" and "Chicago", use
person.values()
person={"name": "John", "city":"Chicago")
How would you change the city to "Pittsburgh"?
person['city'] = "Pittsburgh"
What will be the output of the following lines of code
ssn="982-23-2324"
print(ssn.replace("-",""))
982232324
number_list = [5,10,15,20]
print(number_list[1]-1)
What would be the output of the statements above
9
How many numbers would be gnerated by the following range?
range(0,5,1)
5
for i in range (1,13,4):
print(i,end=" ")
1 5 9
list1 = [43,78,43,34]
list2 = [34,78,89]
set1 = set(list1)
set2 = set(list2)
set3 = {78, 908}
seta = set1.intersection(set2)
What elements does SetA contain
34 78
def describe_pet(animal_type, pet_name):
print(f "I have a {animal_type}.")
print(f "My {animal_type}’s name is {pet_name}.")
What code would be used to call the function?
describe_pet(animal_type = "Dog", pet_name = "Charlie")
customers = [{‘name’:'Peter','Zip':'23467'},{‘name’:'Xia','Zip':'12344'}]
which code would give
23467
12344
print(each_item['zip'])
my_list= [98,73,29,24,23]
Write code to print only those values less than or equal to 50. Format to 2 decimal places.
print(each_item[<50].2f)
To link multiple tables together, you typically try to create a relationship between _____.
Two columns with identical column names
In Tableau, a numeric float column from a CSV will typically be considered a ____
measure
To change the value in one cell, use ____.
df.loc[row, col ] = value
To make sure data change in a data source such as an Excel file is reflected in a Tableau visualization, connections to data sources should be configured as ____.
live
df['length'].isna() will return ___.
a boolean series
Which method can show you a variety of statistics for a DataFrame?
describe()
To open a CSV file in Pandas, use ___.
read_csv(url)
Abbreviate a Python module with a 'nickname' using the ____ keyword
as
Data about data is known as _____.
metadata
Add a reference to a python library using the keyword ____.
import
Which of the following can properly drop a column 'name'?
df.drop(columns='name')
Rows and columns of data are represented as a _____, in Pandas.
DataFrame
Which of the following drops row with index 250 correctly?
df2 = df.drop(index=250)
The first 5 rows of data in a DataFrame could be seen using ___.
head(5)
In Python method that has a loop, the return keyword should ideally be placed inside the for loop.
False
For the code below, what would be printed out?
person = {"name": "John","city": "Chicago", }
for each_item in person:
print(each_item)
name
city
Two sets are being joined, Set 1 and Set 2. What method would join these sets such that it includes all elements of Set 1 and Set 2?
union
person={"name": "John", "city":"Chicago")
to get a list containing "name" and "city", use
person.keys()
A list can have elements added to it
True
How many partitions will result from the following?
line = "Mary had a little lamb"
partitions = line.partition(" ")
3
number_list = [5, 10, 15, 20]
print(number_list[3])
What would be the output of the statements above?
20
Which of the following creates a tuple?
numbers = (1, 2, 3)
Which of the following is a correct formulation of an if statement that tests if x is greater than 10.
if x > 10:
print("x is greater than 10")
You can test multiple conditions in Python conditional statements using ____ keyword
elif
A boolean value can have up to _ different values.
2
% is the ____ operator.
remainder
The value 34.23 should be a ____ type in Python.
float
= FunctionA ( FunctionB ( 2, 2.5 ) )
First the Inside function FunctionB, then the outside function FunctionA
Assume a formula in a cell C2 has the cell reference $A2.
The formula is copied over to the cell D3.
The formula in D3 will be ____.
$A3
Assume a formula in a cell B2 has the cell reference $C2.
The formula is copied over to the cell B3.
The formula in D3 will be ____.
$C3
To convert a cell to capitalize the first letter of each word in the cell text (convert the first letter of each word to uppercase), use function ____.
proper
A function with zero arguments requires parentheses.
True
If you want to visually emphasize data cells that meet a certain rule, use ___.
Conditional Formatting
If you want to find out the number of times the value "In Stock" occurs in a column, use ____.
COUNTIF
A CSV is _____.
comma separated value
Which of the following is the correct way to write a formula to add up cells C1 through C3?
=Sum(C1:C3)
How many cells are included in B3:B9? Enter a numeral, e.g., 1 or 2
7
If Katya writes "Product(B2, 5)" into cell C2, she would see ____.
Product(B2, 5) displayed in cell C2.
In class, we discussed that a SSN Number__.
Should be treated like a Text because you don't want to do math on it
Considering the cell value "=Sum(C2:D3)", the range in the formula is ____
C2:D3