Instructor solution
Performing basic math operations in Python (0:56 - 5:15)
You may exit out of this review and return later without penalty.
Unit 1: Python Basics - Review Assignment
1.Comment out one line from the following code so that print(c) prints 5.
2.What's a syntax error?
3.What's a variable?
4.What does syntax mean?
5.Write code to print the sum of two variables, a and b.
6.Fix the syntax error in the starting code.
7.What's the result of the following code:
python<br>a_var = 10<br># a_var = 20<br>a_var += 1<br>print(a_var)<br>
8.What's the difference between Code A and Code B:
Code A:
python<br>a_var = 15 # this sets a_var to 15<br>
Code B:
python<br>"""this sets a_var to 15"""<br>a_var = 15<br>
9.Describe line-by-line what the following code does:
python<br>a = 1<br>b = 2<br>c = a+b<br># d = c*2<br>e = c*b<br>e -= a<br>
10.Write code to do as described in the comments.
11.What is coding?
12.What are some advantages of Python?
13.Who is the creator of Python?
14.What's the difference between Sublime Text and Microsoft Word?
15.How would you characterize the popularity of Python?
16.What does the following code print:
python<br>x = 15<br>y = 10<br>z = 33<br>print(x)<br>print(y)<br>print(z)<br>
17.What's the BASH command to execute a Python program?
18.What are two different ways you can increment a variable a by 2?
You may exit out of this review and return later without penalty.