forked from A-zhudong/python-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also TOC for easier navigation.
- Loading branch information
abregman
committed
Jun 25, 2022
1 parent
837eee3
commit 0255339
Showing
13 changed files
with
191 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Classes 101 - Solution | ||
|
||
## Objectives | ||
|
||
1. Define a class that does nothing and name it `SomeClass` | ||
2. Create an instance of the class you defined and assign it to the variable `c` | ||
3. True or False? In case of `c.x = 1`, `x` is a variable of value 1 | ||
4. How to retrieve the value of `x` attribute from the previous question? | ||
|
||
Click [here to view the solution](../../solutions/classes/101.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## Attributes | ||
# Attributes | ||
|
||
Explain class attributes vs. instance attributes | ||
## Objectives | ||
|
||
1. Explain class attributes vs. instance attributes | ||
2. True or False? not every object in Python has attributes | ||
3. True or False? An attribute doesn't exist on the variable, but rather on the object that the variable refers to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
## Python Characteristics | ||
## Python Characteristics - Solution | ||
|
||
## Objectives | ||
|
||
1. What are some characteristics of the Python programming language? | ||
2. What type of applications use Python? | ||
|
||
Click here for the [solution](solutions/hello_world/python_characteristics.md) | ||
Click [here to view the solution](../../solutions/hello_world/python_characteristics.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Classes 101 - Solution | ||
|
||
## Objectives | ||
|
||
1. Define a class that does nothing and name it `SomeClass` | ||
2. Create an instance of the class you defined and assign it to the variable `c` | ||
3. True or False? In case of `c.x = 1`, `x` is a variable of value 1 | ||
4. How to retrieve the value of `x` attribute from the previous question? | ||
|
||
## Solution | ||
|
||
1. | ||
|
||
```python | ||
class SomeClass: | ||
pass | ||
``` | ||
|
||
2. | ||
|
||
```python | ||
c = SomeClass() | ||
``` | ||
|
||
3. False. in `c.x`, `x` is an attribute of the instance `c` and not a variable | ||
4. `c.x` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Hello World | ||
|
||
## Objectives | ||
|
||
1. Write one line of code that will print "Hello World!" | ||
2. Now modify the code so the output looks like this: | ||
|
||
``` | ||
Hello | ||
World | ||
``` | ||
|
||
## Solution | ||
|
||
1. print("Hello World!") | ||
2. print("Hello\n World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.