(1/13/2014 -- 6:30pm EST)
Add your questions in the Q&A section
(see question mark icon above)
Why do exercises start at number 0?
What does "python" do when written in the terminal?
"CRTL + C" to stop your Python programs
explain cd, ls, mkdir (Bash basics)
print 'hello world'
print boy
#### Try to understand what the error messages here mean
Why does the # in print "Hi # there." not get ignored? The # in that code is inside a string, so it will be put into the string until the ending " character is hit. These pound characters are just considered characters and aren't considered comments. How do I comment out multiple lines? Put a # in front of each one.
5 + 10 * 2 --> 25
5 > 10 - 9 -->
#### You should try, though, to always be explicit (generally true in coding)
5 + (10 * 2) --> 25
4 / 3 --> 1
4.0 / 3 --> 1.3333333333333333
4 % 3 --> 1
student_count = 20
auditor_count = 5
total_count = student_count + auditor_count
print new_variable # What happens if we run this?
print "new_variable" # how about this?
5 + 7 # this expression reduces to (or represents) the number 12
2 # reduces to the value 2
'Learn' + 'Code' # reduces to the value 'LearnCode'
a = 5 # assignment of a value to a variable is a statement
print (5 + 7) #printing is a statement (addition here is also an expression)
"boy" --> string
'boy' --> string
boy --> variable name (you need to assign a value to it somewhere)
"2" --> string
2 --> number
print "Boy named %s" % "John" --> "Boy named John"
print "Boy is %d years old" % 2 --> "Boy is 2 years old"
example = """
This is a sample string
spread over multiple lines
"""
"Alternating between single and double quotes will 'work' just fine"
'It "works" in both directions'
"Alternatively, you can use \"backslashes\" instead"