Update page 'Day 2 homework - Sloetjes'
@@ -34,9 +34,9 @@ The overall return value of each expression is the value assigned to the corresp
|
||||
| **0.0**| Not equal | Not equal | Equal | Equal | Not Equal |
|
||||
| **0j** | Not equal | Not equal | Equal | Not equal| Equal |
|
||||
|
||||
####3. Now do the same thing for the + and == operators for each pair of types in two other 5x5 tables.
|
||||
#### 3. Now do the same thing for the + and == operators for each pair of types in two other 5x5 tables.
|
||||
|
||||
####The "+" operator case:
|
||||
#### The "+" operator case:
|
||||
| | **'0'** | **b'0'** | **0** | **0.0**| **0j** |
|
||||
|---|---------|---------|---------|---------|---------|
|
||||
| **'0'** | '00' | TypeError | TypeError | TypeError | TypeError |
|
||||
@@ -45,7 +45,7 @@ The overall return value of each expression is the value assigned to the corresp
|
||||
| **0.0**| TypeError | TypeError | 0.0 | 0.0 | TypeError |
|
||||
| **0j** | TypeError | TypeError | 0j | TypeError| 0j |
|
||||
|
||||
####The "==" operator case:
|
||||
#### The "==" operator case:
|
||||
|
||||
| | **'0'** | **b'0'** | **0** | **0.0**| **0j** |
|
||||
|---|---------|---------|---------|---------|---------|
|
||||
@@ -55,7 +55,7 @@ The overall return value of each expression is the value assigned to the corresp
|
||||
| **0.0**| False | False | True | True| False |
|
||||
| **0j** | False | False | True | False| True |
|
||||
|
||||
####4. Write a small program that uses the AST module to open the lexer/parser example, and dumps the resulting AST. See if there are any arguments to the parse method which make the output easier to read.
|
||||
#### 4. Write a small program that uses the AST module to open the lexer/parser example, and dumps the resulting AST. See if there are any arguments to the parse method which make the output easier to read.
|
||||
|
||||
```
|
||||
import ast
|
||||
@@ -71,7 +71,7 @@ tree = ast.parse(source)
|
||||
print(ast.dump(tree, indent=4))
|
||||
```
|
||||
|
||||
####5.What does this do? `print("\007")` Can you figure out why?
|
||||
#### 5.What does this do? `print("\007")` Can you figure out why?
|
||||
|
||||
The statement `print("\007")` prints **a bell character to the console**. The `“\007”` escape sequence represents **the ASCII code for the bell character**, which is also known as the alert or bell control character.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user