Week 2
Conditional execution and other goodies
A few more words on Python
When people say Python is "easy"
They really mean "straight forward"
The initial learning process is still hard
Python makes it the least awful
Let the "black box" be dark for a little longer
You will have lots of "why" and "how" questions.
Love it! But let's chat about that.
You can't always understand the answers without the foundations you're getting now.
Conceptual versus skill based learning
Compare this to accounting.
There are important concepts to understand, but the initial learning tends to be more on the side of skill based practice.
Once you get through this slog you can get into theory. Which is awesome!
Now, let's get back to code.
Conditional execution!
Semantic
What you were trying to say versus what you actually said.
print versus return
Syntax
What and how you can say things.
print versus Print
the basic if
if something...
then do this stuff...
name = "Elizabeth"
if name == "Elizabeth":
print "I know you!"
elif name == "":
print "Who are you again?"
else:
print "I don't know you."
Grader example
This was one of the chapter problems.
Starting logic
100+ -> A+
90-99 -> A
80-89 -> B
70-79 -> C
60-69 -> D
0-59 -> F
In Python
grade > 90
grade > 80
versus
grade >= 90
grade >=80
Hint: think about a grade of 90
Do we need to say
grade >= 80 and grade <89 ?
What should our logic be?
We'll explore this more later
Any other things you have questions about?
Introduction to Programming with Python week 2
By Elizabeth W.
Introduction to Programming with Python week 2
- 1,086