CS101 Lab 01
CS101 Lab 01
To learn
Computational
Thinking !
What is computational thinking?
It’s a problem solving process with the following three steps.
What is computational thinking?
It’s a problem solving process with the following three steps.
Step 2. Learn to express the solution in a way a computer (a machine or a human) can understand
and effectively carry out →“ instruction”
What is computational thinking?
Formulate:
It’s a problem solving process with the following three steps.
Problem: 1) Ingredients (flour,
salt, baking soda,
How do you make a chocolate, etc.)
chocolate chip 2) cooking tools
Step 1. Formulate a problem Instruction:
cookie? (oven, baking
sheet, spatula,
Step 2. Learn to express the solution in a way a computer1)(a machine
Preheat oven
or a human)
etc.) can understand
and effectively carry out →“ instruction” 2) Make dough
a) Mix sugar, flour,
egg, salt
b) Batter
3) Bake in the oven
What is computational thinking?
It’s a problem solving process with the following three steps.
Step 2. Learn to express the solution in a way a computer (a machine or a human) can understand
and effectively carry out →“instruction”
Step 3. Execute
What is computational thinking?
Formulate:
It’s a problem solving process with the following three steps.
Problem: 1) Ingredients (flour,
salt, baking soda,
How do you make a chocolate, etc.)
chocolate chip 2) cooking tools
Step 1. Formulate a problem Instruction:
cookie? (oven, baking
sheet, spatula,
Step 2. Learn to express the solution in a way a computer1)(a machine
Preheat oven
or a human)
etc.) can understand
and effectively carry out →“ instruction” 2) Make dough
a) Mix sugar, flour,
Step 3. Execute egg, salt
b) Batter
3) Bake in the oven
What is computational thinking?
It’s a problem solving process with the following three steps.
It’s 2020, and if you think you are better off at solving problems by
Step 1. Formulate a problem
writing down equations with pencils on paper, think again.
It’s 2017, and if you think you are better off at solving problems by
Step 1. Formulate a problem
writing down equations with pencils on paper, think again.
We will learn how to solve problems by
Step 2. Learn to express the solution in a way
computational a computer (a machine or a human)
of can understand
We will use thinking with the help
computer programming
and effectively carry outWe will use a programming language called Python
Python programming language
Step 3. Execute
questions?
Course Logistics
Course Structure & Schedule
4 Homework
11 Lectures
Assignments
cs101.kaist.ac.kr
→Syllabus
2 Exams
10 Labs (Midterm and
Final)
Course Structure
Everything is
4 Homework
11 Lectures
Assignments
scheduled and fixed
WHY?
2 Exams
10 Labs (Midterm and You can plan your
Final)
semester NOW
Grading
Lecture 1
doesn’t
count 4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
1. looking
When at solutions or
violated,
program code that are not your
own (internet,Ffriend,
1. Immediate to BOTHstranger,
the
4 Homework tutor, etc. ) the provider
10 Lectures 10 Labs copier AND
Assignments
(100 points) (100 points)
(200 points)
2. share
2. your solution
Suspension code with
from school
other students
4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
Programming
Tasks
(10 points)
Each Lab
Your program must be
errorless
AND
You’ll be aske d to
explain what you did and
how you did it to a TA
Programming
TA must sign you off
Tasks
(10 points)
Each Lab
Your program must be
errorless
AND
You’ll be aske d to
explain what you did and
how you did it to a TA
Programming
TA must sign you off
Tasks
(10 points) Gre at opportunity
for YOU to
practice with the
TA’s he lp
If you’re absent from the lab
NO EXCUSE ACCEPTED
(except your own funeral)
No email submission
No evaluation on previous lab work
If you’re absent from the lab
Did programming
tasks completely in Up to 5 points
another lab section
Programming Not My
Tasks Score !
Learning to program is like learning a foreign language, except it’s more fun!
Civilization IV
Battle fie ld 2
Youtube
Any cheating
is strictly
prohibited in
CS101.
Honor Code Agreement Read the whole
text on the left
carefully.
Write down your
name & date if
you agree.
If you do NOT
agree, you
cannot take
cs101 :(
Honor Code Agreement
Completed!
Useful resources
You’re alone in your dorm room trying to study…
and stuck…
How do I use
random
function?
http://docs.python.org/3/...
These two
websites are
usually good
signs!
http://stackoverflow.com/...
Useful resources
http://docs.python.org/3/
“ the official python 3 documents”
http://stackoverflow.com/
“ most beloved Q&A website in computer science”
Some Basics for
Today's Tasks
Today's Tasks
create_world()
hubo = Robot()
hubo.set_trace('blue')
Some Basics of cs1robot library
create_world()
hubo = Robot()
hubo.set_trace('blue')
Some Basics of cs1robot library
create_world()
hubo = Robot(beepers=10) ← Create a robot with 10 beepers
hubo.set_trace('blue') (beeper={??} is optional)
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
hubo.turn_left()
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
hubo.turn_left()
hubo.move()
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
hubo.turn_left()
hubo.move()
hubo.drop_beeper()
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
hubo.turn_left()
hubo.move()
hubo.drop_beeper()
hubo.pick_beeper()
✓ Before picking up a beeper, hubo should be
on a beeper!
Some Basics of cs1robot library
from cs1robots import *
create_world()
hubo = Robot(beepers=10)
hubo.set_trace('blue')
hubo.drop_beeper()
hubo.move()
hubo.turn_left()
hubo.move()
hubo.drop_beeper()
hubo.pick_beeper()
hubo.pick_beeper()
How to Load World?
from cs1robots import *
load_world('worlds/hurdles1.wld')
hubo = Robot()
hubo.set_trace('blue')
create_world()
hubo = Robot()
hubo.set_trace('blue') Do NOT repeat yourself!
If you have code that will be repeated
# Write your own code below ! several times, define that code as a
def turn_right(): function! Give your code a descriptive
hubo.turn_left() name.
hubo.turn_left() → Much simpler & human-readable code
hubo.turn_left()
hubo.turn_left()
hubo.move()
turn_right()
hubo.move()
turn_right()
hubo.move()
How to Use For-Loop
from cs1robots import *
create_world()
hubo = Robot()
hubo.set_trace('blue') Do NOT repeat yourself!
We can repeat the same code using for-
# Write your own code below ! loop!
def turn_right():
for i in range(3):
hubo.turn_left()
hubo.turn_left()
hubo.move()
turn_right()
hubo.move()
turn_right()
hubo.move()
Week 1
Today's Tasks
Task 1: ZigZag