Skip to content

Incorrect Type Annotation in lesson 6 Lists, Tuples & Dictionary for american_cities (Should Be list, Not dict) #23

@Malik-Ameer-Hamza

Description

@Malik-Ameer-Hamza

In the README section titled "2. Creating a Dictionary", the provided example incorrectly uses a type annotation that does not match the data structure.

Problem:

The following line appears in the example code:

american_cities: dict = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]

This line suggests that american_cities is a dictionary, but in reality, it is a list of strings.

Using dict as the type annotation for a list is misleading and incorrect, especially for beginners learning Python. It contradicts the concept being demonstrated and may cause confusion.

Suggested Fix:

Update the line to use the correct type annotation:

american_cities: list = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]

This correction will accurately reflect that american_cities is a list of strings, not a dictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions