27 January, 2015

Basic Python Variables




varString = "This is a string variable. It can have " \
            "any combination of letters, numbers, or " \
            "special characters."

varIntegr = 32

varLong = "12345L"

varFloat = 1290.60

varList = [1, 2, 3.5, "Ben", "Alice", "Sam"]

varTuple = (4, 5, 6.5, "Alex", "Barbara", "Amy")

varDictionary = {'First': 'The first item in the dictionary',
                 'Second': 'The second item in the dictionary'}

print(varString)
print(varIntegr)
print(varLong)
print(varList)
print(varTuple)
print(varDictionary)

Run module! 

>>> 
This is a string variable. It can have any combination of letters, numbers, or special characters.
32
12345L
[1, 2, 3.5, 'Ben', 'Alice', 'Sam']
(4, 5, 6.5, 'Alex', 'Barbara', 'Amy')
{'Second': 'The second item in the dictionary', 'First': 'The first item in the dictionary'}