Basic variable types in Python consist of strings and numeric types. Let's look at both of these types in this section.
Variables and types
Strings
In Python, a string is a variable type that stores text characters such as letters, numbers, special characters, and punctuation. In Python, we use single or double quotation marks to indicate that the variable is a string rather than a number:
var = 'Hello, World!'
print(var)
Strings cannot be used for mathematical operations on numbers. But they can be used for other useful operations, as we see in the following example:
string_1 = '1'
string_2 = '2'
string_sum = string_1 + string_2
print(string_sum)
The result of the preceding code is to print...