0% found this document useful (0 votes)
4 views10 pages

Coding Course

This document outlines a self-paced beginner's course in Python programming, designed for total novices with no prior coding experience. The course emphasizes hands-on learning through building small programs, covering essential concepts such as variables, decision-making, loops, functions, and culminates in a project to create a tip calculator. Each module includes practical exercises and troubleshooting tips to help learners understand and fix common coding errors.

Uploaded by

syedadd420
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Coding Course

This document outlines a self-paced beginner's course in Python programming, designed for total novices with no prior coding experience. The course emphasizes hands-on learning through building small programs, covering essential concepts such as variables, decision-making, loops, functions, and culminates in a project to create a tip calculator. Each module includes practical exercises and troubleshooting tips to help learners understand and fix common coding errors.

Uploaded by

syedadd420
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SHORT COURSE · SELF-PACED · PYTHON

Your First Steps in Code


A hands-on beginner's course — from “I've never coded” to building small
programs that actually run.

Who this is for


A total beginner who has never written a line of code. No prior experience, no math background,
and no special software needed to start — just curiosity and a willingness to make mistakes.

How this course is different


Coding is learned by doing, not reading. So every module ends with a small program you
actually build and run — not just a quiz.
Each module also has a “When it breaks” section, because reading error messages and fixing
bugs is half of real coding.
We use Python: it's the friendliest first language, reads almost like English, and is used
everywhere from web apps to science.

At a glance
Module You'll build Time

0. Setup & first run A “Hello, world” program ~30 min

1. Variables & data A simple greeting bot ~45 min

2. Making decisions A positive/negative checker ~45 min

3. Loops & repetition A multiplication table ~50 min

4. Functions & reuse A reusable mini-calculator ~50 min

5. Your first project A tip calculator (all of it) ~60 min

Your First Steps in Code Page 1


MODULE 0
Setup & Your First Run
~30 minutes · Getting started

What you'll learn


• What “writing code” actually means and what a programming language is.
• How to run Python without installing anything complicated.
• How to run your very first program.

The core idea


Code is just a set of precise instructions you write for a computer to follow, one line at a time,
exactly as written. The computer does nothing you didn't tell it to do — which is why bugs are
normal: they're almost always a small mismatch between what you meant and what you typed.

Get a place to run code (easiest path)


1. Open a browser and search “online Python editor” — options like [Link] or the official
[Link] “Try” shell work with zero install.
2. You'll see a text area to type code and a “Run” button. That's all you need.
3. (Optional, later: install Python from [Link] to run code on your own computer.)

Your first program


Type this exactly, then press Run:

print("Hello, world!")

If you see Hello, world! appear, congratulations — you just ran a program. The print() command
displays whatever you put inside the quotes.

When it breaks
SyntaxError → usually a missing quote or parenthesis. Every ( needs a ), and quotes come
in pairs.
Type it yourself rather than copy-pasting — you'll learn the punctuation faster.

Build & check


Make the program print your own name instead of “Hello, world!”. If it runs, you're ready for
Module 1.

Your First Steps in Code Page 2


MODULE 1
Variables & Data
~45 minutes · Storing information

What you'll learn


• How to store information in variables.
• The basic data types: text, whole numbers, and decimals.
• How to get input from a person and show it back.

The core idea


A variable is a labeled box that holds a value so you can use it later. You create one by giving it
a name and a value with the = sign. The name goes on the left, the value on the right.

name = "Sam"
age = 16
height = 1.72
print(name)

The three types you'll use most


Type What it is Example

String (text) Letters/words in quotes "hello", "Sam"

Integer (int) Whole numbers 7, 0, -3

Float Decimal numbers 1.72, 3.14

Getting input
The input() command pauses and waits for the person to type something:

name = input("What is your name? ")


print("Hello, " + name + "!")

When it breaks
Adding text and a number directly causes a TypeError. Input is always text — wrap numbers
with int(...) to do math: age = int(input("Age? "))

Build & check


Build a greeting bot: ask the person's name AND their favorite hobby, then print a friendly
sentence using both. Example: “Nice to meet you, Sam! Enjoy your skateboarding.”

Your First Steps in Code Page 3


MODULE 2
Making Decisions
~45 minutes · if / else

What you'll learn


• How programs make choices with if, elif, and else.
• Comparisons: equal to, greater than, less than.
• Why indentation (spaces) matters in Python.

The core idea


An if statement runs a block of code only when a condition is true. The indented lines
underneath belong to that condition — indentation is how Python knows what's “inside.”

age = int(input("Your age? "))


if age >= 18:
print("You can vote.")
else:
print("Not yet — soon!")

Comparison operators
Symbol Means

== is equal to (two equals signs!)

!= is not equal to

>/< greater than / less than

>= / <= greater-or-equal / less-or-equal

More than two options: elif

score = int(input("Score? "))


if score >= 90:
print("A")
elif score >= 80:
print("B")
else:
print("Keep going!")

When it breaks
Using = instead of == in a condition is the #1 beginner bug. One = assigns; two == compares.
IndentationError → lines inside an if must be indented the same amount (4 spaces is
standard).

Your First Steps in Code Page 4


Build & check
Build a checker that asks for a number and prints whether it's positive, negative, or zero — using
if, elif, and else.

Your First Steps in Code Page 5


MODULE 3
Loops & Repetition
~50 minutes · Doing things many times

What you'll learn


• How to repeat actions without copy-pasting code.
• The two main loops: for (a set number of times) and while (until something changes).
• How to avoid an accidental infinite loop.

The core idea


A loop repeats a block of code so you don't write it over and over. A for loop runs a known
number of times; a while loop runs as long as a condition stays true.

# Count 1 to 5
for number in range(1, 6):
print(number)

range(1, 6) gives the numbers 1, 2, 3, 4, 5 — it stops before the last number, which surprises
everyone at first.

A while loop

count = 5
while count > 0:
print(count)
count = count - 1
print("Liftoff!")

When it breaks
Infinite loop: if a while condition never becomes false, the program runs forever. Make sure
something inside the loop changes (like count = count - 1). Press Stop / Ctrl-C to escape
one.

Build & check


Build a program that asks for a number, then prints its multiplication table from 1 to 10 (e.g. for
7: “7 x 1 = 7” ... “7 x 10 = 70”) using a loop.

Your First Steps in Code Page 6


MODULE 4
Functions & Reuse
~50 minutes · Packaging your code

What you'll learn


• How to bundle code into a reusable function.
• How to pass information in (parameters) and get a result out (return).
• Why functions make programs easier to read and fix.

The core idea


A function is a named recipe: you define it once, then “call” it whenever you need it. It can take
inputs (parameters) and hand back a result (return).

def greet(person):
return "Hello, " + person + "!"

message = greet("Sam")
print(message)

Here def creates the function, person is the input, and return sends back the result you can
store and use.

Why bother?
• No repetition: write the logic once, reuse it everywhere.
• Easier fixes: a bug lives in one place, not scattered across your file.
• Readable: a well-named function explains itself at a glance.

When it breaks
Forgetting return means the function does the work but hands back nothing (None). If your
result is empty, check that you returned it.
Calling a function before defining it causes a NameError — define it higher up in the file.

Build & check


Build a function add(a, b) that returns the sum of two numbers, and a function multiply(a, b) that
returns the product. Call each one and print the results.

Your First Steps in Code Page 7


MODULE 5
Your First Real Project
~60 minutes · Putting it together

What you'll learn


• How to combine variables, input, decisions, and functions into one working program.
• How to break a problem into small steps before coding.
• That you can already build something genuinely useful.

The project: a tip calculator


You'll build a program that asks for a bill amount and a service rating, then calculates the tip and
total. This uses every skill from Modules 1–4.

Step 1 — plan it in plain English first


1. Ask for the bill amount (a number).
2. Ask how the service was (good / okay / poor).
3. Choose a tip percentage based on the rating.
4. Calculate the tip and the total.
5. Show the result clearly.

Step 2 — a starting structure

def get_tip_rate(rating):
if rating == "good":
return 0.20
elif rating == "okay":
return 0.15
else:
return 0.10

bill = float(input("Bill amount? "))


rating = input("Service (good/okay/poor)? ")

rate = get_tip_rate(rating)
tip = bill * rate
total = bill + tip

print("Tip: " + str(round(tip, 2)))


print("Total: " + str(round(total, 2)))

When it breaks
Mixing text and numbers in print causes a TypeError — wrap numbers in str(...) as
shown.

Your First Steps in Code Page 8


round(value, 2) keeps money to two decimal places.

Build & extend


Get it working, then add one upgrade of your choice: split the total between several people,
reject negative bills, or let the user enter a custom tip percentage. Extending working code is
exactly how real programmers learn.

You did it!


You went from never having coded to building a real, useful program using variables, input,
decisions, loops, and functions. Every other language and concept builds on these same
foundations. Keep building small things — that's the whole secret.

Your First Steps in Code Page 9


Appendix: Beginner Cheat Sheet

The essentials
To do this... Write this

Show something on screen print("text")

Store a value name = "Sam"

Ask the user for input x = input("Question? ")

Turn text into a number int(x) or float(x)

Make a decision if ...: / elif ...: / else:

Repeat a set number of times for i in range(1, 6):

Repeat until a condition ends while condition:

Make a reusable function def name(input): return ...

Reading an error message


• Read the LAST line first — it names the error type and usually the line number.
• SyntaxError: a typo — missing quote, bracket, or colon.
• NameError: you used a name that isn't defined (typo or used too early).
• TypeError: mixing incompatible types, like text + number.
• IndentationError: spacing inside a block is inconsistent.

The beginner's mindset


Errors aren't failure — they're the computer telling you exactly where to look. Every
programmer, at every level, spends much of their time fixing them. Type code by hand, run it
often, and change one thing at a time.

Your First Steps in Code Page 10

You might also like