import sys
print(f"Python {sys.version.split()[0]}")Python 3.11.9
Variables, f-strings and lists
import sys
print(f"Python {sys.version.split()[0]}")Python 3.11.9
name = "Data Analyst"
salary = 65000
is_active = True
print(f"{name} earns ${salary:,} per year")
print(f"Active: {is_active}")Data Analyst earns $65,000 per year
Active: True
The salary above is an example value used to practise formatting numbers, not market data.
skills = ["Python", "SQL", "Excel", "Tableau"]
print(f"Skills: {', '.join(skills)}")
print(f"Total skills: {len(skills)}")
top_3 = skills[:3]
print(f"Top 3: {top_3}")Skills: Python, SQL, Excel, Tableau
Total skills: 4
Top 3: ['Python', 'SQL', 'Excel']
f"...") insert values into text and can format numbers ({salary:,}).skills[:3]) takes part of a list.