PYTHON Challenge
START
GOODLUCK!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the datatype of the variable in the following line? X= 12.48
Float
Integer
String
Boolean
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
How is a Dictionary indicated in Python?
curly braces { }
square brackets [ ]
parentheses ( )
curly braces with { : }
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the output of the following code?
dict = {"name": "John Doe", "age": 30, "country": "USA"}
print(dict["name"])
30
"name": "John Doe"
None of the above
John Doe
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the difference between '==' and '=' in Python?
'==' for value equality, '=' for strings & integers
They are the same
'==' for value equality, '=' for assigning variable
'==' for strings & integers'=' for value equality
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you sort a DataFrame by values in a specific column in ascending order?
df.sort_values(['column_n\ ame'], ascending=True)
df.sort_values(column='colum\n_name', ascending=False)
df.sort_by(column='column_n\ame', ascending=False)
df.sort(column='column_nam\e', ascending=True)
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you drop rows with missing values in a pandas DataFrame?
df.fillna()
df.dropna()
df.dropnul()
df.remove_na()
6 3.200 POINTS
1 100 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you add a new column 'B' to an existing pandas DataFrame 'df' with default values of 0?
df['B'] = 0
df.insert('B', 0)
df.add_column('B', 0)
df.create_column('B', 0)
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
Which of the following is a valid method to perform an inner join between two pandas DataFrames?
df1.merge('df2', how='inner')
df1.concat([df1],[df2], 'inner')
pd.merge(df1,df2,\how='inner')
df1.join('df2', how='inner')
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How do you access a value in a DataFrame by its column and index?
df[index_value]['column_name']
df["index_value"]["column_name"]
None of the above
df.index_value.column_name
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How do you rename a column in a DataFrame in Pandas assuming inplace is True?
df.rename({'old':'new'}, axis=1)
df.rename(['old','new'], axis=1)
10
df.rename({'old','new'}, axis=1)
df.rename(columns=('old','new'))
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
WELL DONE!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
YOU WIN!
1.000.000 POINTS
BACK
Python Challenge 1
Sayed Ali
Created on July 12, 2023
Start designing with a free template
Discover more than 1500 professional designs like these:
View
Piñata Challenge
View
Pixel Challenge
View
Corporate Challenge Game
View
Catch the Stars
View
Movie Minigames
View
Question Wheel
View
Character Clue Game Mobile
Explore all templates
Transcript
PYTHON Challenge
START
GOODLUCK!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the datatype of the variable in the following line? X= 12.48
Float
Integer
String
Boolean
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
How is a Dictionary indicated in Python?
curly braces { }
square brackets [ ]
parentheses ( )
curly braces with { : }
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the output of the following code?
dict = {"name": "John Doe", "age": 30, "country": "USA"}
print(dict["name"])
30
"name": "John Doe"
None of the above
John Doe
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
What is the difference between '==' and '=' in Python?
'==' for value equality, '=' for strings & integers
They are the same
'==' for value equality, '=' for assigning variable
'==' for strings & integers'=' for value equality
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you sort a DataFrame by values in a specific column in ascending order?
df.sort_values(['column_n\ ame'], ascending=True)
df.sort_values(column='colum\n_name', ascending=False)
df.sort_by(column='column_n\ame', ascending=False)
df.sort(column='column_nam\e', ascending=True)
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you drop rows with missing values in a pandas DataFrame?
df.fillna()
df.dropna()
df.dropnul()
df.remove_na()
6 3.200 POINTS
1 100 POINTS
7 6.400 POINTS
2 200 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How can you add a new column 'B' to an existing pandas DataFrame 'df' with default values of 0?
df['B'] = 0
df.insert('B', 0)
df.add_column('B', 0)
df.create_column('B', 0)
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
Which of the following is a valid method to perform an inner join between two pandas DataFrames?
df1.merge('df2', how='inner')
df1.concat([df1],[df2], 'inner')
pd.merge(df1,df2,\how='inner')
df1.join('df2', how='inner')
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How do you access a value in a DataFrame by its column and index?
df[index_value]['column_name']
df["index_value"]["column_name"]
None of the above
df.index_value.column_name
1 100 POINTS
6 3.200 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
4 800 POINTS
9 25.600 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
RIGHT!
8 12.800 POINTS
3 400 POINTS
9 25.600 POINTS
4 800 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
How do you rename a column in a DataFrame in Pandas assuming inplace is True?
df.rename({'old':'new'}, axis=1)
df.rename(['old','new'], axis=1)
10
df.rename({'old','new'}, axis=1)
df.rename(columns=('old','new'))
6 3.200 POINTS
1 100 POINTS
2 200 POINTS
7 6.400 POINTS
WRONG!
3 400 POINTS
8 12.800 POINTS
9 25.600 POINTS
4 800 POINTS
10 1.000.000 POINTS
5 1.600 POINTS
START OVER?
WELL DONE!
1 100 POINTS
6 3.200 POINTS
7 6.400 POINTS
2 200 POINTS
8 12.800 POINTS
3 400 POINTS
4 800 POINTS
9 25.600 POINTS
5 1.600 POINTS
10 1.000.000 POINTS
YOU WIN!
1.000.000 POINTS
BACK