๐I CREATED MY OWN PASSWORD GENERATOR! ๐
CLICK HERE and press "Run" to try it out.
Yesterday I learned how to use python loops and the range() function. Sunday being a much lazier day to write a post, but anyway, lets get straight to the code!
Lessons
- Better plan weekends to fit in study time. Yeah, it's a challenge.
TO THE CODE!!!
loops.py - basic "for loop"
# for loop
# for item in list_of_items:
# #Do something to each item
fruits = ["Apple", "Peach","Pear"]
for fruit in fruits:
print(fruit)
# Output:
# Apple
# Peach
# Pear
range.py - working with the "range()" function
# Range
# for number in range(a, b):
# print(number)
for number in range(1, 10):
print(number)
#OUTPUT
# 1
# 2
# 3
# 4
# 5
# 6
# 7
# 8
# 9
# You can specify a step
for number in range(1, 11, 3):
print(number)
#OUTPUT
# 1
# 4
# 7
# 10
# Solving Gauss's problem when he was 10 years old
# https://www.americanscientist.org/article/gausss-day-of-reckoning
total = 0
for number in range(1, 101):
total += number
print(total)
#OUTPUT
# 5050
This was a fun day of python! If you want to see if your password was leaked you can check out this site.