Add 57 new questions and exercises
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
## (Advanced) Identify the data type
|
||||
|
||||
For each of the following, identify what is the data type of the result variable
|
||||
|
||||
1. a = {'a', 'b', 'c'} -> set
|
||||
2. b = {'1': '2'} -> dict
|
||||
4. c = ([1, 2, 3]) -> list
|
||||
4. d = (1, 2, 3) -> tuple
|
||||
4. e = True+True -> int
|
12
exercises/python/solutions/data_types_solution.md
Normal file
12
exercises/python/solutions/data_types_solution.md
Normal file
@ -0,0 +1,12 @@
|
||||
## Data Types - Solution
|
||||
|
||||
1. a = [1, 2, 3, 4, 5] -> list
|
||||
2. b = "Hello, is it me you looking for?" -> string
|
||||
3. e = 100 -> int
|
||||
4. f = '100' -> string
|
||||
5. i = 0.100 -> float
|
||||
6. i = True -> bool
|
||||
|
||||
### Bonus question - Answer
|
||||
|
||||
`type(...)`
|
16
exercises/python/solutions/reverse_string.md
Normal file
16
exercises/python/solutions/reverse_string.md
Normal file
@ -0,0 +1,16 @@
|
||||
## Reverse a String - Solution
|
||||
|
||||
```
|
||||
my_string[::-1]
|
||||
```
|
||||
|
||||
A more visual way is:<br>
|
||||
<i>Careful: this is very slow</i>
|
||||
|
||||
```
|
||||
def reverse_string(string):
|
||||
temp = ""
|
||||
for char in string:
|
||||
temp = char + temp
|
||||
return temp
|
||||
```
|
Reference in New Issue
Block a user