Module 1 of 6, Python Foundations
Getting Started
Write and run your first programs, and store values in named variables of the right type.
module checksSign in to track
- Lessons complete-, not done
- Lesson quizzes taken-, not done
- Module Labs passed-, not done
- Module exam passed at 80%-, not done
- lessons
- 4
- quiz questions
- 48
- reading time
- 32 min
- exam length
- 15 Q
- coding exercises
- 8
Lessons
- Introduction to PythonMeet Python: what a program is, how the interpreter runs your lines from top to bottom, and how to read an error message without panic. 8 min 12 questions
- Your First Python ProgramWrite your first real programs: shape print() output with sep, end and escape sequences, and follow Python's rules for lines, indentation and comments. 8 min 12 questions
- Variables & Dynamic TypingStore values under names, change them as the program runs, update them with +=, swap two at once, and mark values that should never change as constants. 8 min 12 questions
- Core Data Types & Type ConversionLearn Python's everyday types, int, float, str and bool, check a value's type with type(), and convert between them with int(), float(), str() and bool(). 8 min 12 questions
Lab: write it yourself
Real Python, real checks: write your answer, press Run checks, and keep going until it passes. (4 exercises)
The Lab needs an account. Sign in or create a free ID to run these exercises.
Lab 1: Say hello
Print exactly Hello, Bangladesh! on one line.
Sign in to practise
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Lab 2: Bus tickets
One Dhaka-to-Gazipur ticket costs 450 taka. Store the price and the number of tickets (3) in variables, then print the total.
Sign in to practise
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Lab 3: Student ID line
Store the name Mim and age 17 in variables, then print them on ONE line separated by a space: Mim 17.
Sign in to practise
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
Lab 4: Swap two cups
a holds "tea" and b holds "coffee". Swap their values so printing gives coffee tea.
Sign in to practise
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and save your practice. Practice does not award XP.
References & Further Reading
Related entries from PyLabs's own reference library.