Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python3.2
- # -*- coding: utf-8 -*-
- # main.py
- """ Task: Exercise 2.4
- Assume that we execute the following assignment statements:
- width = 17
- height = 12.0
- For each of the following expressions, write the value of the expression
- and the type (of the value of the expression).
- 1. width/2
- 2. width/2.0
- 3. height/3
- 4. 1 + 2 * 5
- Use the Python interpreter to check your answers.
- """
- # Main
- width = 17
- height = 12.0
- print("width = 17\nheight = 12.0") # \n = CRLF (new Line)
- print("width/2: " + str(width/2) + ", Type: " + str(type(width/2)))
- print("width/2.0: " + str(width/2.0) + ", Type: " + str(type(width/2.0)))
- print("height/3: " + str(height/3) + ", Type: " + str(type(height/3)))
- print("1 + 2 * 5: " + str(1 + 2 * 5) + ", Type: " + str(type(1 + 2 * 5)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement