11. Which code prints all numbers from 3 to 7?

  • for i in range(3, 4, 5, 6, 7):

        print(i)

  • for i in range(8):

        print(i)

  • for i in range(3, 7):

        print(i)

  • for i in range(3, 8):

        print(i)

12. How many times does the following code print the "security alert" message?

count = 0

while count < 10:

print("security alert")

count = count + 1

  • 5
  • 0
  • 9
  • 10

Weekly challenge 1

13. Fill in the blank: Automation is _____.

  • the use of human and manual effort to reduce technological power consumption
  • the use of technology to reduce human and manual effort to perform common and repetitive tasks
  • the combination of technology and manual effort to complete a task
  • the replacement of existing technology

14. What is wrong with the following code?

for username in failed_login:

print(username)

  • The line with for username in failed_login: is not indented.
  • The first line should be split in two, and in failed_login: should be indented on the new line.
  • The line with print(username) is not indented.
  • Both lines are not indented.

15. What data type requires quotation marks (" ")?

  • Boolean
  • String
  • Float
  • Integer

16. Which line of Python code would create a Boolean value of True?

  • print(“True”)
  • print([“Boolean”])
  • print(25<24)
  • print(10<100)

17. Which line of code assigns the string "dtanaka" to a variable called username?

  • username = “dtanaka”
  • “dtanaka” = username
  •  username(“dtanaka”)
  • username = dtanaka

18. What will this code do when you run it?

var2 = ["a","b","c"]

var2_type = type(var2)

print(var2_type)

  • Indicate that var2 contains list data
  • Change the data type of var2
  • Output the characters “a”, “b”, and “c” to the screen
  • Print the string “var2_type” to the screen

Shuffle Q/A 2

19. You are checking whether the string stored in a device_id variable matches to the correct device ID, the string "15hgu3769". When it matches, you want to print, "Login successful!". Which conditional statement has the correct syntax needed to do this?

  • if device_id == “15hgu3769”:

    print(“Login successful!”)

  • if “device_id” = “15hgu3769”

    print(“Login successful!”)

  • if “device_id == 15hgu3769”

    print(“Login successful!”)

  • if device_id != “15hgu3769”

    print(“Login successful!”)

20. Fill in the blank: An else statement _____.

  • is required after every if statement
  • executes when the condition in the if statement preceding it evaluates to False
  • executes when the condition in the if statement preceding it evaluates to True
  • contains its own unique condition

Leave a Reply