Summer Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: xmas50

WGU Foundations-of-Programming-Python - Foundations of Programming (Python) - E010 JIV1

Which Python data structure contains only unique elements and does not support indexing?

A.

List

B.

Tuple

C.

Dictionary

D.

Set

How does Jupyter Notebook function as a development environment?

A.

Command-line terminal replacement

B.

Cell-based interactive coding platform

C.

Code editor limited to static text editing

D.

Framework for compiling Python into standalone applications

Which keyword is used to exit a loop prematurely in Python?

A.

return

B.

break

C.

stop

D.

end

What advantage does an integrated terminal provide compared to using a separate terminal application?

A.

Faster code execution speed

B.

Access to additional Python libraries

C.

Eliminates need to switch between applications

D.

Automatic syntax error detection

A program uses this while loop to count down:

count = 5

while count > 0:

print(count)

Which issue is preventing the loop from working correctly?

A.

There is a missing colon after the condition.

B.

It runs infinitely because count is never modified.

C.

The condition should use > = instead of > .

D.

The variable should be named differently.

Write a complete function calculate_average(grades) that takes a list of grades and returns the average as a float.

For example, calculate_average([85, 92, 78]) should return 85.0.

def calculate_average(grades):

# TODO: Calculate and return the average grade as a float

pass

Complete the function get_dict_keys(data) that takes a dictionary and returns a list of all its keys.

For example, get_dict_keys({ " name " : " John " , " age " : 25}) should return [ " name " , " age " ].

def get_dict_keys(data):

# TODO: Return a list of all dictionary keys

pass

Fix the logic error in this function that should return the larger of two numbers.

def find_maximum(a, b):

if a < b:

return a

else:

return b

Which Python data structure cannot be modified after creation?

A.

List

B.

Dictionary

C.

Tuple

D.

Set

Write a complete function password_strength(password) that returns " Strong " if the password is at least 8 characters long and contains both letters and numbers, " Weak " otherwise.

For example, password_strength( " abc123def " ) should return " Strong " .

def password_strength(password):

# TODO: Return " Strong " or " Weak " based on password criteria

if len(password) < 8:

return " Weak "

has_letter = False

has_number = False

for char in password:

if char.isalpha():

has_letter = True

elif char.isdigit():

has_number = True

# TODO: Add your return logic here based on has_letter and has_number

pass