Practice Exam (Python)

Question #1

You want to build a program that allows the user to determine how much clout they have based on their follower count. The available options are:

  • (1) Newbie
  • (2) Building the brand
  • (3) Probably a micro-influencer
  • (4) Absolute clout

The program will first ask the user for the number of followers that the user has. It should then determine their clout level based on their follower count. Lastly, it should send the user a message displaying the clout level, like so:

This account's clout level is 'Probably a micro-influencer'.

If the program can't determine what their clout level is for any reason, it'll display an error message.

invalid_input = False # Flag variable checking if the follower_count is a valid number

# Ask the user how many followers the account has
? - Answer A - ?

# If they have 100 or less followers, they're a 'Newbie'
if follower_count >= 0 and follower_count <= 100:
    clout_level = "Newbie"

# If they have between 100 and 1500 followers, they're "Building the brand"
? - Answer B - ?
    clout_level = "Building the brand"

# If they have between 1500 and 5000 followers, they're a micro-influencer
elif follower_count > 1500 and follower_count <= 5000:
    clout_level = "Probably a micro-influencer."

# If they have over 5000 followers, they have absolute clout
elif follower_count > 5000:
    clout_level = "Absolute clout."

# If they don't enter a positive number, change flag variable to true and alert user
? - Answer C - ?
    ? – Answer D - ?
    print("We could not determine the account's clout level. Please enter a valid number.")

# If the input was not invalid, tell the user what the account's clout level is
if invalid_input == False:
    print(? – Answer E - ?)

Answer A: follower_count = int(input("How many followers does the account have? "))

Answer B: elif follower_count > 100 and follower_count <= 1500:

Answer C: Must purchase Python Cram Kit to see.

Answer D: Must purchase Python Cram Kit to see.

Answer E: Must purchase Python Cram Kit to see.


This is the end of the preview. To unlock the rest, get the Lifetime Access, Python Cram Kit or BUS 104 Cram Kit Bundle.

Already purchased? Click here to log in.

Leave a Comment