11. Fill in the blank: The Python _____ function returns a sequence of numbers starting from zero; then increments by one, by default; then stops before the given number.

  • type()
  • range()
  • format()
  • index()

12. What Python code instructs the computer to loop through values from 750 to 850?

  • for x in range(750, 851):
  • for x in range(750, 850):
  • for x in range(751, 851):
  • for x in range(751, 850):

13. A data professional wants to set up a for loop. They write the following code: for x in range(5, 101, 10): . What is the step value of the range() function?

  • 5
  • 100
  • 10
  • 101

14. What Python code can a data professional use to concatenate the strings 'air' and 'plane'?

  • ‘air’ % ‘plane’
  • ‘air’ + ‘plane’
  • ‘air’ / ‘plane’
  • ‘air’ == ‘plane’

15. A data professional wants to identify the location of a character in a string. What Python method can they use to do so?

  • print()
  • index()
  • format()
  • range()

16. A data professional assigns the string 'palm and pine' to the variable trees. What Python code can they use to find the index of the character 'm'?

  • trees.index(‘m’)
  • index.trees(‘m’)
  • index.palm(‘m’)
  • palm.index(‘m’)

17. A data professional assigns the string 'classical' to the variable genre. What Python code will return the slice 'class'?

  • genre[1:5]
  • genre[ :5]
  • genre[5: ]
  • genre[-1]

18. Fill in the blank: In Python, a data professional can use the _____ method to insert specific substrings in a larger string.

  • print()
  • range()
  • format()
  • type()

Shuffle Q/A 2

19. Fill in the blank: A data professional can use a _____ to repeat a specific block of code until a condition is met.

  • for loop
  • while loop
  • else loop()
  • if loop

20. Fill in the blank: The Python range() function returns a sequence of numbers starting from zero; then increments by _____, by default; then stops before the given number.

  • one
  • two
  • zero
  • three

Leave a Reply