Share Your Feedback

Learn Python String Methods & Formatting with Fill in the Blanks

Test your Python skills with Fill in the Blanks on string methods and formatting. Great for beginners learning Python strings through hands-on practice.

๐Ÿ” Fill in the Blanks

๐ŸŸข Beginner

  1. In Python, a string is a sequence of characters enclosed in ________.
  2. Answer

    quotes

    Strings in Python are defined by enclosing characters within single ('') or double ('') quotes.


  3. The operator used to concatenate two strings in Python is ________.
  4. Answer

    +

    The '+' operator is used to concatenate (join) two or more strings in Python.


  5. To repeat a string multiple times in Python, you use the ________ operator.
  6. Answer

    *

    The '*' operator is used to repeat a string a specified number of times.


  7. The method to convert all characters of a string to uppercase is ________.
  8. Answer

    upper()

    The 'upper()' method returns a copy of the string with all characters converted to uppercase.


  9. To remove leading and trailing spaces from a string, use the ________ method.
  10. Answer

    strip()

    The 'strip()' method removes any leading and trailing characters (space is the default) from the string.


  11. The method to check if all characters in a string are digits is ________.
  12. Answer

    isdigit()

    The 'isdigit()' method returns True if all characters in the string are digits.


  13. To replace all occurrences of a substring within a string, use the ________ method.
  14. Answer

    replace()

    The 'replace()' method returns a copy of the string with all occurrences of a substring replaced with another substring.


  15. The method to split a string into a list where each word is a list item is ________.
  16. Answer

    split()

    The 'split()' method splits a string into a list where each word is a list item, using space as the default separator.


  17. To check if a string starts with a specified substring, use the ________ method.
  18. Answer

    startswith()

    The 'startswith()' method returns True if the string starts with the specified value.


  19. The method to convert the first character of each word to uppercase is ________.
  20. Answer

    title()

    The 'title()' method returns a string where the first character of each word is uppercase and the rest are lowercase.


๐ŸŸก Intermediate

๐Ÿ”ด Advanced



๐Ÿ“š Related Resources


๐Ÿง  Practice & Progress

Explore More Topics

๐Ÿฃ Python for Beginners

๐Ÿง  Python Advanced