Learning Rooms/△ Level 2 · Builder/Computing and algorithms
The First Programming Languages: Crash Course Computer Science #11
CrashCourse · Length: see YouTube · captions on YouTube · nothing loads until you press play
By the end you can…
- Write, run and edit a Python program that prints a calculated result with its unit.
- Use variables, arithmetic and print, with comments that state units.
- Change an input and rerun the program to answer a design question.
Watch it all: no segment has been checked by hand for this video yet.
1.Predict before you press play
What does Python print for print(2000 / 250)?
Pick one before you press play. A wrong guess is fine: it is what makes the video stick.
2.See the idea first
Play with this diagram for a minute (borrowed from the lesson “How the interpreter reads your program”, on the same idea). It gives you something to hang the video on.
Loading the interactive…
Can't use the diagram? Read a description instead
The program tracer shows a short Python program, highlights the line just run and lists every variable with its value and type after that line. For example, in 'Battery runtime', after line 3 the table shows capacity_mah 2000 (int), current_ma 250 (int), hours 8.0 (float). In 'Used before it exists', line 2 stops with a NameError because resistance_ohm is created only on line 3.
3.Watch, actively
Why people write programs in languages like Python instead of raw machine code, and what an interpreter or compiler does with them.
Length: see YouTube · captions on YouTube · source
Nothing loads from YouTube until you press play.
Watch for…
- → Listen for why people write in languages like Python instead of machine code, and what has to translate a program before the computer can run it.
Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.
Can't stream it? Read the idea instead
Processors only run machine code, long patterns of bits. Programming languages let people write instructions in readable words, and a compiler or interpreter translates them into machine code. One line of a high-level language can stand for many machine instructions.
What the video covers (our own note, written when we verified it): Why people write programs in languages like Python instead of raw machine code, and what an interpreter or compiler does with them.
Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.
Read it instead
- Lesson: Your first Python program: battery runtime · The full lesson explains the idea in text, worked examples and diagrams, with no video needed.
- Engineering Atlas: Variables, types and expressions · A battery-life calculation whose inputs are named variables with stated units can be checked and rerun by a teammate in seconds.
- Field Guide: Variables and assignment · A short reference entry on the same idea.
Jot down one thing that surprised you and one question you still have.
4.Practise what you just saw
These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.
Practice 1
What does Python do with # battery capacity in mAh?
Practice 2
Using the same formula, a 3000 mAh battery powers a 25 mA device. How many days is that?
Practice 3
Which variable name is best for a current measured in milliamps?
Practice 4 · a fresh version every time
A sensor node runs from a 2500 mAh battery and draws a steady 50 mA. A program computes hours = 2500 / 50 and then minutes = hours * 60. What value does minutes hold, in minutes? (Ignore the battery ageing or the voltage dropping.)
6.Where engineers use it
Wireless sensor nodes are designed around this exact calculation, then made to sleep most of the time: an average of 1 mA instead of 25 mA turns days into months.
From the applied view in the lesson Your first Python program: battery runtime. Checked by automated tests only.
7.Build something with it
Follow-up project
Extend the program: add a variable for a safety margin (use only 80 % of the capacity) and print the runtime with and without the margin, each with its unit. Write one comment explaining why engineers keep a margin.
Where this video lives
- Your first Python program: battery runtime · Level 2, week 2
In the course catalogue: CSE-210 Python for engineers
The video is by CrashCourse, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.