![]() ![]() The second problem is that I am unsure how to separately store input. Dictionaries and lists share the following characteristics: Both are mutable. ![]() The first is that (with my current code) asking for the favorite color and favorite car works properly but then simply asks for the favorite color again rather than ending the running loop and printing the results. The items in the list can be accessed by an index (based on their position) whereas items in the dictionary can be accessed by keys and not by their position. A Python list is an ordered sequence of objects, whereas dictionaries are unordered. Lists A list is defined by using square brackets, and, and consists of some set of entries separated by commas, e.g. Then I am looking to gather input from multiple users (asking the same two questions multiple times) and store the results in a dictionary. Python lists and dictionaries are two data structures in Python used to store data. Lists, tuples and dictionaries are some of the tools that Python provides for doing this. List of dictionary means multiple dictionaries are enclosed within square brackets. I am seeking to gather both the user’s favorite color and favorite car. In Python, a dictionary is represented in the form of key-value pairs.
0 Comments
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |