Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Intro to Python
COSC 101: Intro to Computing I
January 26, 2017
Spring 2017
COSC 101: Introduction to Computing I
1
“Pop Quiz”
Spring 2017
COSC 101: Introduction to Computing I
2
Question 1
Execute:
>>> print("I am so excited to learn Python!")
Output:
I am so excited to learn Python!
Spring 2017
COSC 101: Introduction to Computing I
3
Question 2
Execute:
>>> print("six times seven is . . . “)
>>> 6 + 7
Output:
six times seven is . . .
13
Error:
This is a semantic error because the code runs, but it does
not do what we want it to do.
Spring 2017
COSC 101: Introduction to Computing I
4
Question 3
Execute:
>>> print("Hello, world"
Error:
This is a syntax error; the code will not run because there
is no end parenthesis.
Spring 2017
COSC 101: Introduction to Computing I
5
Question 4
Execute:
>>> print("the chance of precipitation today is:")
>>> 7 / 10 * 100
>>> print("%")
Output:
the chance of precipitation today is:
70.0
%
Spring 2017
COSC 101: Introduction to Computing I
6
Question 5
Execute:
>>> 16 / (5 - 5)
Error:
This is a runtime error because the code is syntactically
correct but does not run. In this case the problem is that
our code attempts to divide by zero.
Spring 2017
COSC 101: Introduction to Computing I
7
Register & Configure Python Anywhere
Spring 2017
COSC 101: Introduction to Computing I
8
1. Go to pythonanywhere.com
2. Click start
Spring 2017
COSC 101: Introduction to Computing I
9
3. Click to create a Beginner account
4. Register using your Colgate username and email
Spring 2017
COSC 101: Introduction to Computing I
10
5. Click Account
6. Click Teacher
7. Enter mesmith
Spring 2017
COSC 101: Introduction to Computing I
11
8. Return to your Dashboard and start a new Python 3.5 console
9. Begin writing Python code!
Spring 2017
COSC 101: Introduction to Computing I
12
Python Exercises
•
Run the code from the earlier “pop quiz” in the
python interpreter.
•
Use the interpreter as a calculator to solve simple
math problems.
•
Create a new file and write a python program that
introduces yourself to the people sitting next to you.
•
Write code with syntax, semantic, and runtime
errors.
Spring 2017
COSC 101: Introduction to Computing I
13
Register for Gradescope
Spring 2017
COSC 101: Introduction to Computing I
14
1. Go to gradescope.com
2. Click Sign up for free
Spring 2017
COSC 101: Introduction to Computing I
15
3. Click I am a student
Spring 2017
COSC 101: Introduction to Computing I
16
4. Enter your information and entry code MBYWV9
5. Follow link from your email to create a password
Spring 2017
COSC 101: Introduction to Computing I
17
Homework 0
Spring 2017
COSC 101: Introduction to Computing I
18