Python GUI Programming with PyQt: A Beginner’s Guide to Python 3 and GUI Application Development by Nathan Metzler

Python GUI Programming with PyQt: A Beginner’s Guide to Python 3 and GUI Application Development by Nathan Metzler

Author:Nathan Metzler [Metzler, Nathan]
Language: eng
Format: azw3, epub
Published: 2020-05-19T16:00:00+00:00


The number of iterations a loop will go through will be equal to the number of elements present in a list/tuple if control statements are not used inside the loop.

14. Dictionary

A dictionary is a feature rich data type where data is stored in key-value pairs. In simple terms, we can refer to a key as a meaningful index. People with programming background will be able to relate a dictionary to a hash table. Keys and values could be of any data types but it makes a lot of sense to use something meaningful as a key and hence numbers and strings are preferred. A dictionary can be created by enclosing <key>:<value> pairs, separated by commas, enclosed within curly brackets. General Syntax:

<dictionary> = {<key 1>: <value 1>, <key 2>: <value 2>, … <key n>: <value n>}

Example:

person_data = {‘name’ : ‘Karrie’, ‘age’ : 25, ‘country’ : ‘Norway’}

In this example, there are 3 keys of string type – ‘name’, ‘age’ and ‘country’ holding the values ‘Karrie’, 25 and ‘Norway’ respectively. You could have keys and values of literally any data types including complex number, lists, tuples, etc. But for simplicity sake, I have chosen keys of string type. This is how the dictionary person_data will look in the memory:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.