Module 1
>Python Basics
Start writing and running clear Python programs with confidence.
// Lessons
5
// Quiz questions
50
// Reading time
46 min
// Exam length
15 Q
// Coding exercises
9
- 1Introduction to PythonExplain what Python does, where it is used, and run code in the editor. 7 min 10 questions
- 2Your First Python ProgramUse print() to show text and values, including the sep and end arguments. 8 min 10 questions
- 3Python Syntax and CommentsWrite correctly structured statements and add comments that explain your code. 10 min 10 questions
- 4Variables and ConstantsStore, change, name, and swap values with variables and recognize constants by convention. 10 min 10 questions
- 5Data Types and Type ConversionRecognize common data types and convert values explicitly when your program needs it. 11 min 10 questions
Coding practice: write it yourself
Real Python, real checks: write your answer, press Run checks, and keep going until it passes. (0/4 passed this visit)
You can run every exercise now. Create a free ID to keep passes, code attempts and XP.
Lab 1: Say hello
Not passed yetPrint exactly Hello, Bangladesh! on one line.
# Print the greeting below
Lab 2: Bus tickets
Not passed yetOne Dhaka-to-Gazipur ticket costs 450 taka. Store the price and the number of tickets (3) in variables, then print the total.
price = 450 tickets = 3 # print the total cost
Lab 3: Student ID line
Not passed yetStore the name Mim and age 17 in variables, then print them on ONE line separated by a space: Mim 17.
name = "Mim" age = 17 # print both, space-separated
Lab 4: Swap two cups
Not passed yeta holds "tea" and b holds "coffee". Swap their values so printing gives coffee tea.
a = "tea" b = "coffee" # swap, then print(a, b)
References & Further Reading
Related entries from PyLabs's own reference library.