Value of variable


Can we assign other type of values rather than numerical to a variable in python?



Standard Data Types
The data stored in memory can be of many types. For example, a person’s age is stored as a numeric value and his or her address is stored as alphanumeric characters. Python has various standard data types that are used to define the operations possible on them and the storage method for each of them.

Python has five standard data types −


See TutorialsPoint page on the topic.


Thank you. This is helpful.


We could add a couple of others that are standard data types…


A set is written like a dictionary, in curly braces, but is not made up of key-value pairs, only comma separated values. Like a dictionary it is unordered, but unlike a dictionary it is immutable and we need to use special methods to add to or remove items. Sets are similar to tuples, which are also immutable, though they do preserve their order. Unlike sets, tuples cannot have values added or removed. We can only unpack a tuple into its individual components.