Python: Dictionary [Data Type]

Dictionary in Python is a collection of key/value pairs. Dictionaries use keys(labels) to store item/value references, instead of numbered index. Python Dictionary is a unordered and mutable collection of Zero(0) or more key/value pairs. Only hashable objects can be used as key in a Dictionary. Dictionary items are not ordered, and are not stored in … Read more

Python: List [Data Type]

List in Python is a data type that stores a collection of data, of one or more types. Python list is mutable. Lists are ordered collections of items. Items in the list store the order of each item.

Python: Integer [Data Type]

Integer in Python represents whole numbers, without any fractional part. An integer can be positive, negative, or zero. NOTES Max size of an integer in Python depends on the memory of the machine. Integers can be very large in Python, though working with a very large integer will be very slow. If the integer in … Read more

Python: String [Data Type]

What is a String? String in Python is- Examples of String Create String Use “str” function to create a new string. If no value is provided to “str” function then an empty string is created- Output: We can wrap a sequence of characters with single or double quotes to define a string literal. Output: Multi-line … Read more

Python: Data Types

General Data Types Data Type Python Type Immutable & Hashable Boolean bool Yes Integer int Yes Floating point number float Yes String str Yes Bytes bytes Yes Collection Data Types Data Type Python Type Immutable & Hashable Tuple tuple Yes Set set No Frozen Set frozenset Yes List list No Dictionary dictionary No

Python: Variables and Scope

When a program runs, it stores the data it requires, in the memory(RAM). A variable is used to store a reference address of a memory. So the program can store that in the reference address and retrieve data when required. In simple language- A variable is a named identifier(of some memory location), and we can … Read more

Python: Program Structure

We can structure our Python program in 3 ways- All these 3 ways can be combined together to create a full program. Sequential Steps Output: Conditional Steps Output: Repeated Steps Output: