Skip to content

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

  1. 1Introduction to PythonExplain what Python does, where it is used, and run code in the editor. 7 min 10 questions
  2. 2Your First Python ProgramUse print() to show text and values, including the sep and end arguments. 8 min 10 questions
  3. 3Python Syntax and CommentsWrite correctly structured statements and add comments that explain your code. 10 min 10 questions
  4. 4Variables and ConstantsStore, change, name, and swap values with variables and recognize constants by convention. 10 min 10 questions
  5. 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)

All module exercises

You can run every exercise now. Create a free ID to keep passes, code attempts and XP.

Lab 1: Say hello

Not passed yet

Print exactly Hello, Bangladesh! on one line.

# Print the greeting below

Lab 2: Bus tickets

Not passed yet

One 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 yet

Store 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 yet

a 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.

  • print() (Print objects to the text stream file, separated by sep and followed by end.)
  • input() (Read a line of text typed by a user.)
  • type() (Find out what type of value an object is.)