Add 57 new questions and exercises

This commit is contained in:
abregman
2021-08-13 09:23:50 +03:00
parent 6e01886e6b
commit 3b05d95256
27 changed files with 1981 additions and 242 deletions

View File

@ -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

View 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(...)`

View 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
```