0% found this document useful (0 votes)
47 views90 pages

CS101 Lab 01

This document provides an overview of CS101 Introduction to Programming. It discusses that the course will cover computational thinking and problem solving using Python programming. It will include 11 lectures, 10 labs, and 4 homework assignments over the semester. Students will be graded based on their exam, lab, and homework scores. Academic honesty is stressed, and cheating is defined as sharing or obtaining solutions or code that is not one's own work.

Uploaded by

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

CS101 Lab 01

This document provides an overview of CS101 Introduction to Programming. It discusses that the course will cover computational thinking and problem solving using Python programming. It will include 11 lectures, 10 labs, and 4 homework assignments over the semester. Students will be graded based on their exam, lab, and homework scores. Academic honesty is stressed, and cheating is defined as sharing or obtaining solutions or code that is not one's own work.

Uploaded by

chaosofdoomx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 90

Welcome !

CS101 Introduction to Programming


Week 1
Introduction
+
Course Logistics
+
Some tiny bit of python
What will you
learn in CS101?
Our goal in CS101
Our goal in CS101

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 1. Formulate a problem


What is computational thinking?
It’s a problem solving process with the following three steps.
Problem:

How do you make a


Step 1. Formulate a problem chocolate chip
cookie?
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
cookie? (oven, baking
sheet, spatula,
etc.)
What is computational thinking?
It’s a problem solving process with the following three steps.

Step 1. Formulate a problem

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 1. Formulate a problem

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.

Step 2. Learn to express the


Wesolution
will useincomputer
a way a computer (a machine or a human) can understand
programming
and effectively carry out
We will use a programming language called Python
Step 3. Execute
What is computational thinking?
It’s a problem solving process with the following three steps.

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

YOUR FINAL GRADE

2 Exams (Midterm and Final) + Homework Scores

Lecture 1
doesn’t
count 4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)

Your Hard Work


Academic Honesty
Everyone should’ve signed the
honor code.
YOUR FINAL GRADE

2 Exams (Midterm and Final) + Homework Scores

4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)

Your Hard Work


Academic Honesty
Everyone should’ve signed the
honor code.
YOUR FINAL GRADE
What we consider as
2 Exams (Midterm and Final) + Homework Scores CHEATING in CS101:
1. looking at solutions or
program code that are not your
own (internet, friend, stranger,
4 Homework
10 Lectures 10 Labs
Assignments
tutor, etc. )
(100 points) (100 points)
(200 points)
2. share your solution code with
other students

Your Hard Work 3. NOT indicating on your


submission any assistance you
Academic Honesty received
Everyone should’ve signed the
honor code.
YOUR FINAL GRADE
What we consider as
2 Exams (Midterm and Final) + Homework Scores
CHEATING in CS101:

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

3. NOT indicating on your


Your Hard Work
submission any assistance you
Academic Honesty received
Trust me, we are REALLY good at
catching cheaters
Practice
YOUR FINAL GRADE Points >= 340
Le cture 2 ~ 1 Lecture = 10 points
2 Exams (Midterm and Final) + Homework Scores Le cture 11

10 Lectures = 100 points

4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)

Your Hard Work


Academic Honesty
Practice
YOUR FINAL GRADE Points >= 340
2 Exams (Midterm and Final) + Homework Scores 1 Lecture = 10 points

10 Lectures = 100 points

4 Homework 1 Lab = 10 points


10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
10 Labs = 100 points

Your Hard Work


Academic Honesty
Practice
YOUR FINAL GRADE Points >= 340
2 Exams (Midterm and Final) + Homework Scores 1 Lecture = 10 points

10 Lectures = 100 points

4 Homework 1 Lab = 10 points


10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)
10 Labs = 100 points

1 Home work assignme nt


= 50 points
Your Hard Work
Academic Honesty 4 Home work assignme nts
= 200 points
Practice
YOUR FINAL GRADE Points >= 340
2 Exams (Midterm and Final) + Homework Scores 1 Lecture = 10 points

11 Lectures = 110 points

4 Homework 1 Lab = 10 points


10 Lectures
(100 points)
10 Labs
(100 points)
Assignments Total = 400
(200 points)
10 Labs = 100 points
points
1 Home work assignme nt
= 50 points
Your Hard Work
Academic Honesty 4 Home work assignme nts
= 200 points
Practice
YOUR FINAL GRADE Points > 300
Out of 400 available practice points, you must collect at least
2 Exams (Midterm and Final) 1 Lecture = 10 points
340 points to be conside re d to be grade d on your e xam
11 Lectures = 110 points
score s.
4 Homework 1 Lab = 10 points
11 Lectures 10 Labs
Othe rwise , immediate F.
Assignments
10 Labs = 100 points

→Practice points are a “ qualification”1 Homework = 50 points


Your Hard Work
4 Labs = 200 points
Academic Honesty
Practice
YOUR FINAL GRADE
For Example,
Points > 300
2 Exams (Midterm 1 Lecture = 10 points
Student A and Final)

Theory 70 11 Lectures = 110 points


Point

4 Homework 1 Lab = 10 points


11 Lectures Practice 340
10 Labs
Point Assignments
10 Labs = 100 points
Final Score B+
1 Homework = 50 points
Your Hard Work
4 Labs = 200 points
Academic Honesty
Practice
YOUR FINAL GRADE
For Example,
Points > 300
2 Exams (Midterm 1 Lecture = 10 points
Student A and Final)

Theory 70 11 Lectures = 110 points


Point
1 Lab = 10 points
11 Lectures Practice 340
10 Labs ≥4 340
Homework
Point Assignments
(pass)
10 Labs = 100 points
Final Score B+
1 Homework = 50 points
Your Hard Work
4 Labs = 200 points
Academic Honesty
Practice
YOUR FINAL GRADE
For Example,
Points > 300
2 Exams (Midterm 1 Lecture = 10 points
Student A and Final)

Theory 70 11 Lectures = 110 points


Point
1 Lab = 10 points
11 Lectures Practice 340
10 Labs ≥4 340
Homework
Point Assignments
(pass)
10 Labs = 100 points
Final Score B+
1 Homework = 50 points
Your Hard Work
4 Labs = 200 points
Academic Honesty
Practice
YOUR FINAL GRADE
For Example,
Points > 300
2 Exams (Midterm 1 Lecture = 10 points
Stude nt A and Final) Student B

The ory 70 Theory 97 11 Lectures = 110 points


Point Point
1 Lab = 10 points
11 Lectures Practice 340
10 Labs ≥4 340
Homework
Practice 339 < 340
Point Assignments
(pass) Point (fail)
10 Labs = 100 points
Final Score B+ Final Score F
1 Homework = 50 points
Your Hard Work
4 Labs = 200 points
Academic Honesty
Practice
YOUR FINAL GRADE
For Example,
Points > 300
2 Exams (Midterm 1 Lecture = 10 points
Stude nt A and Final) Student B

The ory 70 Theory 197 11 Lectures = 110 points


Point Point

4 Homework 1 Lab = 10 points


11 Lectures Practice 340
10 Labs Practice 339
Point Assignments
Point
10 Labs = 100 points
Final Score B+ Stude nt
Final Score FB
1 Homework = 50 points
Your Hard Work
4 Labs = 200 points
Academic Honesty
Theory Points
YOUR FINAL GRADE
Midterm exam = 100 * 0.4 points
Final exam = 100 * 0.5 points
2 Exams (Midterm and Final) + Homework Scores
Homework = 200 * 0.05 points

Total = 100 points

4 Homework
10 Lectures 10 Labs
Assignments
(100 points) (100 points)
(200 points)

Your Hard Work


Academic Honesty
Your Final
YOUR FINAL GRADE Grade
2 Exams (Midterm and Final) + Homework Scores 1. You must be academically
honest in EVERY part of the
course

4 Homework 2. You must have colle cte d at


10 Lectures 10 Labs least 340 practice points
Assignments
(100 points) (100 points)
(200 points)

If you me e t both 1. and 2.,


You will be grade d only on your
Your Hard Work two exams (midterm 40% +
final 50%) and homework
Academic Honesty
scores (10%)
questions?
Lab sessions
Each Lab

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

You will get 0 points on that week's lab score!!


If you’re absent from the lab

You will get 0 points on that week's lab score!!

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

You may participate in other section’s


lab of the same week

You will be awarded 50% of the score


Lab Score Claim

Programming Not My
Tasks Score !

For each lab, we’re taking score claims


for one week and one week only.
ex) lab 3 score claims → until lab 4
Note: same with lecture attendance scores:
Lecture 6 claim → until Lecture 7
If you couldn’t finish the tasks in the lab

You will get 0 points also.


So, if you think you cannot finish the tasks during lab time,
(1) Do preparations before the lab,
(2) Ask questions to TAs a lot
questions?
Online Lab
Session Process
Instructions for students
1. Login to Elice and go into Lab# tab, at the lab se ssion time
2. Watch the re corde d lab le cture
3. Do the programming tasks
○ If you ne e d any he lp, pre ss He lp button to call TA

4. Afte r you finish the programming tasks, pre ss He lp button to call TA


○ The n, ask TA to che ck your code
○ If you pass TA’s te st, you are fre e to le ave ! TA will che ck mark your atte ndance
Help center
TAs are waiting for your
que stions!

Afte r push the button,


ple ase e xplain whe re
you stuck!
Introduction to
Python
What’s Python??

Learning to program is like learning a foreign language, except it’s more fun!

Python is a (programming) language we use to communicate ourse lve s with a


computer, and with other people (through your software )!
Famous Python Projects
Dropbox

Civilization IV

Battle fie ld 2

Google

Youtube

Instagram

…and many more !!


You can make one too!
Honor Code
Honor Code Agreement
Honor Code Agreement You should
agree with
Honor Code.

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

- How to define function


- How to use for-loop
Robot World (Read the robot notes!)
Some Basics of cs1robot library

from cs1robots import *

create_world()
hubo = Robot()
hubo.set_trace('blue')
Some Basics of cs1robot library

from cs1robots import *

create_world()
hubo = Robot()
hubo.set_trace('blue')
Some Basics of cs1robot library

from cs1robots import * ← Import cs101 robot library!

create_world() ← Create a robot world (defined in cs1robots library)


hubo = Robot() ← Create a robot named 'hubo'
hubo.set_trace('blue') ← Turn on a trace for our robot (hubo) with 'blue' color
Some Basics of cs1robot library

from cs1robots import *

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')

# Write your own code below !

* Instead of using create_world, we


can use load_world
How to Define Function
from cs1robots import *

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

▪ Create a default world.


▪ Add a robot.
▪ Make the robot visit the entire world
in a zigzag fashion.
Task 2: Hurdle

▪ Load the world named ‘hurdles1.wld’.


▪ Add a robot.
▪ Make the robot jump all hurdles and pick up the beeper.
Task 3: Newspaper delivery

▪ Load the world named ‘newspaper.wld’.


▪ Add a robot with one beeper.
▪ Make the robot deliver newspapers and return to his starting point.
Task 4: Harvest

▪ Load the world named ‘harvest1.wld’.


▪ Add a robot.
▪ Make the robot harvest all the carrots (beepers).
Task 5: Harvest again

▪ Load the world named ‘harvest2.wld’.


▪ Add a robot.
▪ Make the robot harvest all the carrots
with the shortest path possible.
Let’s start!

You might also like