Your next chapter / Python values and your weekly study plan

Foundation · 35 MINUTES · VERSION 1

Python values and your weekly study plan

Use clear variable names, calculate study time, and understand type conversion.

Reviewed 23 Oct 2026

Your setup may differ. Windows, Ubuntu, and optional tool bundles →

Log in or create an account to keep private notes, bookmarks, and learning progress. Reading is free without an account.

What you will learn

  • Store text, integers, and Boolean values.
  • Calculate a small weekly study plan.
  • Convert text input deliberately instead of mixing it with numbers.

Theory: values and types

A value has a type. "Python" is a string: text inside quotes. 30 is an integer: a whole number. True and False are Boolean values: they represent yes/no conditions. Python variable names do not start with $, unlike PHP variable names.

Assignment uses =. It attaches a value to a name. Equality uses == to compare two values. Good names describe the meaning: minutes_per_day is clearer than x.

Worked example

Create study_plan.py in your practice folder:

topic = "Python"
minutes_per_day = 30
days = 5
weekly_minutes = minutes_per_day * days
target_minutes = 120
enough_time = weekly_minutes >= target_minutes

print(f"Topic: {topic}")
print(f"Weekly minutes: {weekly_minutes}")
print(f"Target reached: {enough_time}")

Run python study_plan.py on Windows, py study_plan.py if that is your installed launcher, or python3 study_plan.py on Ubuntu/Linux. You can also use your virtual environment's interpreter. The source code is identical on these platforms. Expected output:

Topic: Python
Weekly minutes: 150
Target reached: True

The multiplication uses two integers. >= compares the total with the target. It produces a Boolean value. This is a calculation, not a promise that spending time automatically produces skill.

Guided practice

  1. Change days to 3. Expect Weekly minutes: 90 and Target reached: False.
  2. Change days to 0. Expect zero minutes and False.
  3. Change the topic to SQL. The calculation should stay the same.
  4. Use type(days) in a print statement to inspect its type.

Text is different from a number

"30" is text. 30 is a number. They are different values. Terminal input from input() is text, even when someone types digits. This example demonstrates conversion:

text_minutes = "30"
minutes = int(text_minutes)
print(minutes + 10)

Expected output: 40. Converting "thirty" with int() raises ValueError. Later you will catch that error and show a useful message. Do not silently accept negative study durations in a real application.

Independent exercise

Set a weekly target of 180 minutes. Calculate the number of minutes still needed after studying 25 minutes on four days. Print Minutes remaining: 80. Then try exactly 180 completed minutes: the result should be zero. If the completed time is greater than the target, the remaining time should also be zero, not a negative number.

Common mistakes

  • Writing true instead of True: Python capitalizes Boolean literals.
  • Quoting every number: text cannot be used as an integer without deliberate conversion.
  • Writing = when comparing: use == for equality.
  • Expecting int("thirty") to work: conversion can fail; validate real user input.

Self-check — not graded

  1. Is "5" the same type as 5?
  2. What is the result of 90 >= 120?
  3. Why does int("thirty") fail?

Interview practice

“What should you do before using a number from an input form?” Explain validation, conversion, allowed ranges, and useful errors. The same principle applies to Laravel request validation and Python programs.

English practice and glossary

  • Variable: a name that refers to a value.
  • Integer: a whole number.
  • String: text.
  • Boolean: True or False.
  • Conversion: changing a value into another type when that operation is valid.

Write: “My weekly target is __ minutes. I have completed __ minutes. I still need __ minutes.” Explain the program aloud in three sentences.

Next step

Learn how lists, dictionaries, conditions, and loops work together in a task report.

Reveal exercise hints and self-check answers

Exercise hint: calculate completed minutes first. Use max(target - completed, 0) to keep the remaining number at zero or above. For target 180 and completed 25 * 4, the answer is 80.

  1. No. One is a string and one is an integer.
  2. False, because 90 is below 120.
  3. The text does not represent an integer in the expected format, so Python raises ValueError.

Official references

Practise on your own computer. The exercise self-checks are not graded. This version also has a scored quiz for verified accounts. Signed-in learners can save reading, self-reported practice, private notes, and bookmarks.