CS 105: Intro to Computing, Non-technical Craig Zilles (Computer - - PowerPoint PPT Presentation

cs 105 intro to computing non technical
SMART_READER_LITE
LIVE PREVIEW

CS 105: Intro to Computing, Non-technical Craig Zilles (Computer - - PowerPoint PPT Presentation

CS 105: Intro to Computing, Non-technical Craig Zilles (Computer Science) https://go.illinois.edu/cs105sp20 January 27, 2020 To Today 1. Goals of this course (and why) 2. Structure of this course (and why) 3. Some Computer Basics 4.


slide-1
SLIDE 1

CS 105: Intro to Computing, Non-technical

Craig Zilles (Computer Science) January 27, 2020 https://go.illinois.edu/cs105sp20

slide-2
SLIDE 2

To Today

  • 1. Goals of this course (and why)
  • 2. Structure of this course (and why)
  • 3. Some Computer Basics
  • 4. Programming Language & Python Basics
  • 5. Muddiest Points
  • input/print, types, type conversion, syntax and
  • ther errors
  • 6. Challenge questions

2

slide-3
SLIDE 3

Wh What is Comp mputer Science?

“Computers are to Computer Science what telescopes are to astronomy”

  • Edsger Dijkstra

Computer Science is concerned with understanding:

  • what is computable,
  • how to [specify computations, perform computations,

communicate between computers] in the [fastest, most reliable, most secure, cheapest/lowest power] way,

  • how to help humans solve problems with computers

3

slide-4
SLIDE 4

Th The lear arning objectives s for this s course se

4

slide-5
SLIDE 5

Wh What is “Programmi mming”?

  • A series of instructions that can

be carried out by a computer

  • A really useful skill for many

people

  • Useful to even know what is

possible

http://www.programmingbasics.org/en/beginner/img/commands4.png

slide-6
SLIDE 6

Al Altern rnate Term rms

“Programs” “Software” “Application” “Code”

But not "Codes" – it's always singular!

slide-7
SLIDE 7

Pr Programs are eve verywhere

https://openclipart.org/

slide-8
SLIDE 8

Pr Programs do many things

slide-9
SLIDE 9

Th Three par arts s of writing a a program am

Algorithms:

  • A step-by-step process for achieving a result
  • Often expressed in pseudo-code (instead of a prog. language)
  • Avoid distraction of details
  • Increases generality

Programming:

  • Expressing commands in a form that the computer

understands Testing and Debugging:

  • Making sure that the program (always) does what is intended

9

slide-10
SLIDE 10

Ma Making a Peanut Butter & Jelly Sandwich (a randomly selected student algorithm)

  • Gather your supplies such as bread, a spreading knife,

peanut butter and jelly.

  • Spread peanut butter on one slice of bread using the

knife.

  • Spread Jelly on another slice of bread.
  • Take the two slices and put them in a sandwich form

with the peanut butter and jelly facing eachother.

  • Enjoy.

10

slide-11
SLIDE 11

Na Natural language (English) is too ambiguous

  • “I saw the man in the park with the telescope”
  • Who had the telescope?
  • Who was in the park?

11

slide-12
SLIDE 12

Step 1) Gather Materials Step 2) Lay the two pieces of bread about 8” apart flat on their faces on your working surface. Step 3) Using the knife, scoop a dollop of peanut butter out of the jar roughly 1” in diameter. Spread the dollop evenly on the face of one slice of bread until there is an even layer of peanut butter roughly 1/8” thick. Step 4) Rinse the excess peanut butter off the Knife. Then dry with towel. Step 5) Repeat Step 3 on the other slice of bread replacing the peanut butter with the jelly or jam. Step 6) Place one slice of bread on the plate, jelly side up. Then place the other slice of bread on top of the slice on the plate peanut butter side down, ensure the shapes of the bread slices match and their edges are flush. Step 7) Enjoy!

12

slide-13
SLIDE 13

Ke Key Idea: Pr Programming languages are de designe ned d to be be exact and nd una unambi biguo uous us

  • Everything in a programming language has a precise

form (syntax) and a precise meaning (semantics)

  • Syntax: Rules of what are acceptable programs
  • Semantics: Rules specifying what a program does
  • This need for exactness is challenging for many novices.

13

slide-14
SLIDE 14

Al Also, thi his stuf uff is totally arbi bitrary!

  • Computers and programming languages are human

made

  • There is no reason that you should know any of this

stuff if you haven’t seen it before

  • People in this class that seem “smarter” have probably

seen it before

  • The easiest bugs to find in your code are the ones that

you made before

  • There is no short cut around making mistakes

14

slide-15
SLIDE 15

St Stru ruct cture of

  • f t

this c cou

  • urse
  • The book
  • Pre-lecture activities
  • Lecture
  • Homework
  • Labs
  • Quizzes and Exams
  • Office Hours & Piazza

15

slide-16
SLIDE 16

Wh What is known about teaching and learning (1

(1)

  • 1. No one can pay attention for 90 continuous minutes
  • We’ll have a 5 minute break in the middle of lecture
  • Please try to focus the rest of the time
  • 2. “Time on task” is a primary factor of how much gets

learned.

  • My job, give you productive things to spend time on
  • 3. One learns much more by doing than by reading or

listening.

  • You have to expend mental energy or it doesn’t stick

16

slide-17
SLIDE 17
  • 4. The things you can most efficiently learn are:
  • Those related to things that you already know
  • Those that are only slightly harder than the things you

can currently do

  • 5. Long term retention comes from repeated, distributed(in

time) practice

  • Retention comes from cycles of forgetting and re-

learning

  • Spaced in time; cramming doesn’t work for long term

retention

17

Wh What is known about teaching and learning (2

(2)

slide-18
SLIDE 18

Gr Growth Mindset

18

slide-19
SLIDE 19

Te Teaching by diminishing deception

  • Computers (like many things) are too complicated to

understand all at once.

  • I’m going to glaze over unnecessary details until we’re

ready for them

  • Feel free to ask questions, but I might defer some for

after class / during break

19

slide-20
SLIDE 20

St Stru ruct cture of

  • f t

this c cou

  • urse
  • The book
  • Pre-lecture activities
  • Lecture
  • I clickers, participation encouraged, ask questions,

recorded

  • Homework
  • Labs
  • Quizzes and Exams
  • Office Hours & Piazza

20

slide-21
SLIDE 21

We Weekly cycle:

  • each topic covered over a 1.5 week period
  • Book activities, Pre-lectures have strict deadlines
  • Homework has late deadline for 70% credit.
  • Lecture/Lab allows 2 excused/unexcused absences

21

Lecture Th F Sa Su M Tu Th W F Sa Su Read Book (Participation) Pre-Lecture Book (Challenge) Homework Lab

slide-22
SLIDE 22

We Weekly cycle:

22 Lecture Th F Sa Su M Tu Th W F Sa Su Read Book (Participation) Pre-Lecture Book (Challenge) Homework Lab Lecture Read Book (Participation) Pre-Lecture Book (Challenge) Homework Lab M Tu Th W F Sa Su Read Book (Participation) Pre-Lecture

slide-23
SLIDE 23

Th The homework plag agiar arism sm/collab aboration po policy in n CS 105 is:

Ic Iclic licker que question: n: select the he be best ans answer

A) It is okay to hire random internet strangers to do all of your homework for you. B) You must do all of your homework alone (not even TAs can help) C) You can get any help you want as long as you type in the answers D) Students can only discuss the homework at a high level; code must not be shown to other students, but you can ask TAs for help E) Assignments can be done in groups of two students

23

slide-24
SLIDE 24

Fo Formative vs. Summative Assessment

  • Practice / Formative Assessment:
  • Primarily intended for learning, self-evaluation
  • CS 105: Participation/Challenge, Pre-lecture activities,

Homework

  • You may get help from anyone, but you have to enter

the solution

  • Summative Assessment:
  • An evaluation of how much has been learned
  • CS 105: Quizzes and Exams
  • To be done by yourself; you may not get help from

anyone

24

slide-25
SLIDE 25

Qui Quizzes and nd Exams (al

all to be done by yourself)

  • Four mid-term exams in the Computer-Based Testing

Facility (CBTF):

  • Sign-up at https://cbtf.engr.illinois.edu/sched
  • 4-day window: Thursday – Sunday
  • 50 minutes
  • Four quizzes (basically required practice exams)
  • 50 minutes timed, self-proctored, wherever you want

to take them.

  • 3-day window: Thursday – Saturday
  • One three-hour final exam in the CBTF

25

slide-26
SLIDE 26

Anno Announc uncements: see cour urse web b pa page

  • If you didn’t finish the reading/pre-lecture, deadline

extended to Thurs.

  • Labs begin this week!
  • If you didn’t get checked off in Lab last week:
  • Get checked off for it at the end of lab
  • You can sign up for the first exam now
  • We’re going to give up to 2% extra credit for the ~20

students that have the most Piazza answers marked as good answers.

26

slide-27
SLIDE 27

Com Computer b r basics: m : major p

  • r part

rts

27

"I had difficulty understanding computer components such as memory and storage."

slide-28
SLIDE 28

Mo Modern CPUs like those in laptops, ta tablets, and phones execute how many in instructio ions per second:

Ic Iclicker que question: n: se select the he be best ans answer

A) Thousands B) Millions C) Billions D) Trillions E) Quadrillions

28

slide-29
SLIDE 29

Com Computers a are:

Ic Iclicker que question: n: se select the he be best ans answer

A) Smart B) Not smart

29

slide-30
SLIDE 30

Co Computers run very low-le level l in instructio ions

  • Things like:
  • Move a number from one storage location to another
  • Add two numbers together
  • Check if one number is larger than another
  • Go to a different place in the code
  • Computers can be programmed at this level, but
  • It is very tedious and error prone
  • You have to write a lot of code to do anything

significant

  • This code isn’t portable across different processor

types (e.g., laptops vs phones)

30

slide-31
SLIDE 31

Hi High gh-le level l Lan anguag ages (& Pyth thon)

  • HLLs: productive, safer, portable
  • Python: very useful language, gentle learning curve
  • Once you learn one language, much easier to learn
  • thers (same concepts)
  • Python2 vs. Python3
  • Interpreted language
  • Three ways to run the Python interpreter (at least)
  • Interpreter, Jupyter notebook, and running scripts

from the command line

31

slide-32
SLIDE 32

(In In Python) x + y is is:

Ic Iclicker que question: n: se select the he be best ans answer

a) an assignment b) a statement c) a variable d) an expression e) a comment

32

slide-33
SLIDE 33

Py Python values have ve types

  • "The most confusing part of this weeks reading

assignment was the difference between string and

  • integer. "
  • We’ve met two kinds so far:
  • Strings: e.g., our string literals like “Hello CS 105!”
  • Integers: whole numbers of arbitrary precision
  • You can ask a value what its type is using:

type(expression)

  • You can convert between them with str() and int()
  • It is important that you keep track of the types of your

values!

33

slide-34
SLIDE 34

34

A E D C B

Wh Where does Python run on the comp mputer?

Ic Iclic licker que question: n: se select the he be best ans nswer

slide-35
SLIDE 35

Th The input() fu function gets user input

  • Can take a string as an argument to be used as a prompt
  • Returns a string
  • I am having a hard time differentiating between the use
  • f int(), input() and/or int(input())

35

slide-36
SLIDE 36

The The print() func function

  • Assuming there is a variable value with the value 7,

which of the following statements prints: count = 7 A) print(“count =” value) B) print(“count =”, end=“value”) C) print(“count =”, value) D) print(“count =” + value) E) print(“count = $value”)

36

slide-37
SLIDE 37

Ch Challenge Questions: concepts needed

  • Printing string literals:

print(‘string literal inside quotes’)

  • Knowing that by default print outputs a new line
  • You can use multiple print statements to print multiple lines
  • User input can be assigned to variables:

var_name = input()

  • Input can be converted to integers: int_var_name = int(input())
  • Integers can be added and multiplied: var1 + var2 and var1 * var2
  • Expressions can be printed:

print(number1 – 13)

37