Learn how Python stores data using variables and understand the core data types.
1# Creating variables2name = "Skill-Forge"3age = 214pi = 3.141595is_active = True6 7print(name) # Skill-Forge8print(type(age)) # <class 'int'>Skill-Forge <class 'int'>
1# Integer2count = 423 4# Float5temperature = 36.66 7# String8greeting = "Hello, World!"9 10# Boolean11is_student = True12 13# NoneType14result = None15 16# Check types17print(type(count)) # <class 'int'>18print(type(temperature)) # <class 'float'>19print(type(greeting)) # <class 'str'><class 'int'> <class 'float'> <class 'str'>
1# Valid names2user_name = "Alice"3_private = 424totalCount2 = 1005 6# Invalid names (will cause errors)7# 2nd_place = "Bob" # Can't start with digit8# my-var = 10 # Hyphens not allowed9# class = "Math" # Reserved keyword1# String to Integer2age_str = "25"3age_num = int(age_str)4print(age_num + 5) # 305 6# Integer to String7count = 428message = "Items: " + str(count)9print(message) # Items: 4210 11# Float to Integer (truncates)12pi = 3.9913print(int(pi)) # 330 Items: 42 3