[Solved] METCSS521 Homework1

$25

File Name: METCSS521_Homework1.zip
File Size: 178.98 KB

SKU: [Solved] METCSS521 Homework1 Category: Tag:
5/5 - (1 vote)

Complete the following problems from the textbook: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12 (pages 78 79)

  1. What is a program?
  2. Python is an interpreted language. What does interpreted mean in this context?
  3. What is a Python comment? How do you indicate a comment? What purpose do they serve?
  4. What is a namespace in Python?
  5. Whitespace:
    1. What is whitespace in Python?
    2. When does whitespace matter?
    3. When does whitespace not matter?
  6. Explain the difference between a statement and an expression. Give an example of both, and explain what is meant by a statement having a side effect.
  7. Mixed operations:
    1. What type results when you divide an integer by a float? A float by an integer?
    2. Explain why that resulting type makes sense (as opposed to some other type).
  8. Consider integer values of a, b, and c, and the expression (a + b) * c. In mathematics, we can substitute square brackets, [], or curly braces, {}, for parentheses, (). Is that same substitution valid in Python? Try it.
  9. Assignment:

my_int = 5my_int = my_int + 3print(my_int)

  1. If you execute the three lines of code, what will be printed? Explain your answer using the rules of assignment.
  2. Rewrite my_int = my_int + 3 using the += symbol
  1. Assignment:my_var1 = 7.0my_var2 = 5print(my_var1 % my_var2)If you execute these three lines of code, what will be printed?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] METCSS521 Homework1
$25