for loop is used for iteration over a list(some other data structures)
sports = ["Basketball", "Tennis", "Baseball", "Volleyball"] # this is a for loop for sport in sports: # this will print each strings of the sports list indvidually print(sport)
Basketball Tennis Baseball Volleyball
range function gives sequence of numbers. By default range function starts from 0 and 1 increments.
for number in range(5): print(number)
0 1 2 3 4
range function with multiple arguments
for number in range(5, 101, 10): # range(start, stop, step) print(number)
5 15 25 35 45 55 65 75 85 95
Today has been the a little difficult one so far using the for loop and range function. Learnt how some built-in function works. Used the random library on multiple exercises and got more familiar with
Description: It generates a random password consisting letters, number, and symbols.
My Solution: password_generator.py
P.S. It's fun to watch football while coding!