I have done research and looked for tutorials I will finish it tomorrow
This commit is contained in:
parent
96cd1347d6
commit
855f271883
4 changed files with 32 additions and 9 deletions
Binary file not shown.
|
@ -2,12 +2,9 @@ the_count = [1, 2, 3, 4, 5]
|
||||||
fruits = ['apples', 'oranges', 'pears', 'apricots']
|
fruits = ['apples', 'oranges', 'pears', 'apricots']
|
||||||
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
|
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
|
||||||
|
|
||||||
|
|
||||||
# this first kind of for-loop goes through a listLOOPS AND LISTS
|
# this first kind of for-loop goes through a listLOOPS AND LISTS
|
||||||
for number in the_count:
|
for number in the_count:
|
||||||
print(f"This is count {number}")
|
print(f"This is count {number}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#same as above
|
#same as above
|
||||||
for fruit in fruits:
|
for fruit in fruits:
|
||||||
|
@ -21,13 +18,11 @@ for i in change:
|
||||||
# we can also build lists, first start with an empty one
|
# we can also build lists, first start with an empty one
|
||||||
elements = []
|
elements = []
|
||||||
|
|
||||||
|
|
||||||
# then use the range function to do 0 to 5 counts
|
# then use the range function to do 0 to 5 counts
|
||||||
for i in range(0, 6):
|
for i in range(0, 6):
|
||||||
print(f"Adding {i} to the list.")
|
print(f"Adding {i} to the list.")
|
||||||
|
# append is a function that lists understand
|
||||||
# append is a function that lists understand
|
elements.append(i)
|
||||||
elements.append(i)
|
|
||||||
|
|
||||||
# now we can print them out too
|
# now we can print them out too
|
||||||
for i in elements:
|
for i in elements:
|
||||||
|
|
29
sami/learn-python-the-hard-way/overlap.py
Normal file
29
sami/learn-python-the-hard-way/overlap.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
def overlapping(string1, string2):
|
||||||
|
for i in string1:
|
||||||
|
for e in string2:
|
||||||
|
if i == e:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if address in network:
|
||||||
|
# do something
|
||||||
|
# ipaddress.ip_address('2001:DB8::1')
|
||||||
|
#IPv6Address('2001:db8::1')
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit a0012ef6c4d44c875a3173fc746ab0a9259bc531
|
|
Loading…
Add table
Reference in a new issue