Level
Find the error
-
def format_user_info(name, age, city):
-
    # Format user information
-
    user_info = 'Name: %s, Age: %d, City: %s' % (name, age, city)
-
    print(user_info)
-
    # Using f-string
-
    user_info = f'Name: {name}, Age: {age}, City: {city}'
-
    print(user_info)
-
    # Attempt to use .format()
-
    user_info = 'Name: {0}, Age: {1}, City: {2}'.format{name, age, city}
-
    print(user_info)
-
# Test the function
-
format_user_info('Alice', 30, 'New York')

String Formatting Syntax in Python

In this exercise, you'll encounter different string formatting techniques in Python. Your task is to identify the line with a syntax error in string formatting and then select the correct implementation. Pay close attention to the syntax of the .format() method, focusing on parentheses, curly braces, and argument separation. Remember, we're looking for actual syntax errors, not just suboptimal code.