0
0
AI for Everyoneknowledge~10 mins

AI for data analysis and spreadsheet tasks in AI for Everyone - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load data from a spreadsheet file.

AI for Everyone
data = pd.read_excel([1])
Drag options to blanks, or click blank then click option'
A'data.xlsx'
B'data.csv'
C'data.txt'
D'data.json'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a CSV file name with read_excel causes an error.
Using a JSON or TXT file name with read_excel is incorrect.
2fill in blank
medium

Complete the code to calculate the average of the 'Sales' column.

AI for Everyone
average_sales = data['Sales'].[1]()
Drag options to blanks, or click blank then click option'
Amean
Bmax
Ccount
Dsum
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum() returns total, not average.
Using count() returns number of entries, not average.
3fill in blank
hard

Fix the error in filtering rows where 'Profit' is greater than 1000.

AI for Everyone
high_profit = data[data['Profit'] [1] 1000]
Drag options to blanks, or click blank then click option'
A==
B>
C=
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using = or == causes syntax or logic errors in filtering.
Using < filters the wrong rows.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 4 letters.

AI for Everyone
lengths = {word: [1] for word in words if len(word) [2] 4}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using word instead of len(word) for dictionary values.
Using < instead of > in the condition.
5fill in blank
hard

Fill all three blanks to create a dictionary of uppercase words and their counts if count is more than 1.

AI for Everyone
result = [1]: [2] for [3], count in word_counts.items() if count > 1
Drag options to blanks, or click blank then click option'
Aword.upper()
Bcount
Cword
Dcount.upper()
Attempts:
3 left
💡 Hint
Common Mistakes
Using count.upper() causes error because count is a number.
Swapping word and count in the loop variables.