compsci 6 introduction to computer science sept 29, 2011 prof. rodger “all your troubles are due...
TRANSCRIPT
![Page 1: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/1.jpg)
CompSci 6Introduction to Computer Science
Sept 29, 2011
Prof. Rodger
“All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget you wouldn’t worry.” - The Emerald City of Oz by Frank Baum
1CompSci 6 Fall 2011
![Page 2: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/2.jpg)
Announcements• Exam 1 on Tuesday
• Assignment 3 due tonight– If you are not reading Piazza you are missing out
• Lab Today-Monday– Random numbers
• No Lab Thursday Oct 6-10 for fall break
CompSci 6 Fall 2011 2
![Page 3: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/3.jpg)
Lab 5 – Random Numbers• import random
– Must import to use random and its methods
• Generate random number between 0 and 1random.random()
• Generate a random item from a listrandom.choice(list)
• Generate a random integer from start to end random.randint(start, end)
• See code exampleCompSci 6 Fall 2011 3
![Page 4: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/4.jpg)
Exam logistics• Exam is in the regular classroom B101 LSRC
• Only need a pen or pencil
• No scratch paper
• Will give you a reference sheet of Python information with the test (see resources page)
• Closed book, closed notes, closed neighbor
• Covers lecture, lab and assigned reading
• Have put old quizzes back up as quiz review– This is NOT for a grade, for studying only
CompSci 6 Fall 2011 4
![Page 5: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/5.jpg)
The best way to study
• Write code!
• Resources page has old tests and solutions– Try writing code, then look at solutions
• Rewrite an APT
• Rewrite code we did in lecture
• Rewrite code we did in classwork or lab
CompSci 6 Fall 2011 5
![Page 6: CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not](https://reader036.vdocument.in/reader036/viewer/2022082709/56649f425503460f94c61184/html5/thumbnails/6.jpg)
Understand• What is the difference between: [ ] and ( )
• What is the difference between: – print value and assigning value to a variable– print and return – When do you print? When do you return?– Does a function print or return?
• if, for, lists, list comprehension– Understand format and how they work
• Understand items on Python review sheet on resources page
CompSci 6 Fall 2011 6