Merge remote-tracking branch 'sami/master'
This commit is contained in:
commit
cc4f872d64
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']
|
||||
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
|
||||
|
||||
|
||||
# this first kind of for-loop goes through a listLOOPS AND LISTS
|
||||
for number in the_count:
|
||||
print(f"This is count {number}")
|
||||
|
||||
|
||||
print(f"This is count {number}")
|
||||
|
||||
#same as above
|
||||
for fruit in fruits:
|
||||
|
@ -21,13 +18,11 @@ for i in change:
|
|||
# we can also build lists, first start with an empty one
|
||||
elements = []
|
||||
|
||||
|
||||
# then use the range function to do 0 to 5 counts
|
||||
for i in range(0, 6):
|
||||
print(f"Adding {i} to the list.")
|
||||
|
||||
# append is a function that lists understand
|
||||
elements.append(i)
|
||||
# append is a function that lists understand
|
||||
elements.append(i)
|
||||
|
||||
# now we can print them out too
|
||||
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…
Reference in a new issue