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 2026Your setup may differ. Windows, Ubuntu, and optional tool bundles →
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
- Change
daysto3. ExpectWeekly minutes: 90andTarget reached: False. - Change
daysto0. Expect zero minutes andFalse. - Change the topic to
SQL. The calculation should stay the same. - 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
trueinstead ofTrue: 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
- Is
"5"the same type as5? - What is the result of
90 >= 120? - 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:
TrueorFalse. - 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.
- No. One is a string and one is an integer.
False, because 90 is below 120.- The text does not represent an integer in the expected format, so Python raises
ValueError.