KC Knowledge Check

The Knowledge Check is intended to support learning and self-assessment. The questions highlight the key concepts of this unit and help prepare for the final examination.

The Knowledge Check is not graded.


1️⃣ Strings

What is a string in Python?

Explain in your own words what it means that strings are immutable.


2️⃣ String Methods

Assume:

text = "Python is fun"

Write the Python statements that:

  • count the number of characters and print the result
  • replace “fun” with “easy” and print the result.

3️⃣ Logical Operators

Given:

a = True
b = False

What are the results of:

a and b
a or b
not a

4️⃣ Comparison Operators

Given:

x = 25
y = 30

Write Python expressions, use print() function that check:

  • whether x is smaller than y,
  • whether x is equal to y,
  • whether x is different from y.

5️⃣ Mathematical Operators

Given:

a = 12
b = 5
c = "Python"

What are the results of:

a + c
b * c
a / b
a % b

Discussion

The solutions will be discussed during the course session.

Updated: