There are totally 7 problems in simple exercise I. Most of the exercises in this module are quite simple. I believe that you can do it pretty well. Good luck!
<aside> 💡 1. function
def my_function(): function code here
range(stop) range(start, stop) range(start, stop, step)
range(6) is not the values of 0 to 6, but the values 0 to 5.
range(2, 10, 3) #[2, 5, 8] (not including 10) </aside>
Ans
printMany();
# 1
# 2
# ...
# 100
printEvery3();
# 1
# 4
# ...
# 88
<aside> 💡 #55. Return Keyword #49. Enumerate and Zip Function
This enumerate method would make the iterable objects into tuples, with index and value. Therefore, we can use tuple unpacking for this.
enumerate( iterable, start=0)
parameter: Iterable: String, Lists, tuples, dictionaries, and sets are all iterable objects. Start: the index value from which the counter is to be started, by default it is 0
</aside>
position("abcd") # returns -1
position("AbcD") # returns ('A', 0)
position("abCD") # returns ('C', 2)
<aside> 💡 1. Nested Loop
A nested loop is a loop inside a loop. The "inner loop" will be executed one time for each iteration of the "outer loop":
count() method can count the occurrences.
</aside>
findSmallCount([1, 2, 3], 2); # returns 1
findSmallCount([1, 2, 3, 4, 5], 0); # returns 0
findSmallCount([1, 2, 3, 4, 5], 100) # returns 5