cloning over all the old files

This commit is contained in:
2025-08-04 12:58:29 -04:00
parent 2ec6f34b9a
commit eac63406a2
47 changed files with 3031 additions and 0 deletions
@@ -0,0 +1,64 @@
s1 = [2, 1, 4, 3]
s2 = ["c","a","b"]
print("------------Discussion Part 1----------")
# s1 + s2
print("-----s1 + s2-----")
print(s1 + s2)
#b) 3 * s1 + 2 * s2
print("--------3 * s1 + 2 * s2-----")
print(3 * s1 + 2 *s2)
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#c) s1[1]
print("--------s1[1]-----")
print(s1[1])
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#d) s1[1:3]
print("--------s1[1:3]-----")
print(s1[1:3])
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#e) s1 + s2[-1]
print("--------s1[1:3]------")
print(s1 + [s2[-1]])
print()
print("------------Discussion Part 2----------")
#a)s1.remove(2)
print(s1.remove(2))
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#b)s1.sort()
print(s1.sort())
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#c)s1.append([s2.index("b")]
print(s1.append([s2.index("b")]))
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#d)s2.pop(s1.pop(0))
print(s2.pop(s1.pop(0)))
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
#e)s2.insert(s1[1], "d"
print(s2.insert(s1[1], "d"))
print(f"This is the value of s1: {s1}")
print(f"This is the value of s2: {s2}")
print()
@@ -0,0 +1,27 @@
def removeDuplicates(somelist):
seen = set()
result = []
for i in somelist:
if i not in seen:
seen.add(i)
result.append(i)
return result
def main():
#Create a list with duplicates
somelist = [1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9]
#Display the list
print(somelist)
#Use the remove duplicates function to remove duplicate values
list_parsed = removeDuplicates(somelist)
print(list_parsed)
if __name__ == "__main__":
main()
@@ -0,0 +1,29 @@
from graphics import *
win = GraphWin("My Window", 500, 500)
while True:
key = win.checkKey()
if key == "q": #loop exit
break
if key == "r":
win.setBackground("red")
elif key == "g":
win.setBackground("green")
elif key == "b":
win.setBackground("blue")
elif key == "y":
win.setBackground("yellow")
elif key == "w":
win.setBackground("white")
elif key == "p":
win.setBackground("purple")
elif key == "o":
win.setBackground("orange")
elif key == "c":
win.setBackground("cyan")
else :
win.close()