31. Fill in the blank: A(n) _____ is a set of rules to solve a problem.

  • append
  • algorithm
  • regular expression
  • index

32. Which of the following strings match with the regular expression pattern of "\w"? Select all that apply.

  • “W”
  • “security”
  • “2”
  • “1B”

33. What does the re.findall() function return?

  • All possible regular expressions that match to a given string
  • A list of all matches to a regular expression in a given string
  • The first match to a regular expression in a given string
  • All occurrences of the pattern “re” in a given string

34. What does the code username_list.append("bmoreno") method do?

  • Returns all matches to the pattern “bmoreno” in the username_list list
  • Inserts “bmoreno” at the beginning of the username_list list
  • Adds “bmoreno” to the end of the username_list list
  • Updates all instances of “bmoreno” in the username_list list to uppercase letters

35. Which line of code returns the number of characters in the string assigned to the username variable?

  • print(len(username))
  • print(username.len())
  • print(str(username))
  • print(username.str())

36. Which code joins a list of new_users to a list of approved_users and assigns the value to a third variable named users?

  • users(new_users[1], approved_users[2])
  • users = insert(new_users, approved_users)
  • users = new_users + approved_users
  • users(new_users, approved_users)

37. Fill in the blank: Determining that you need to use string slicing and a for loop to extract information from items in a list is part of creating a(n) _____.

  • index
  • regular expression
  • append
  • algorithm

Leave a Reply