mirror of
https://github.com/RustyRaptor/CS278.git
synced 2026-12-03 20:15:16 -07:00
Started Lab 10
This commit is contained in:
1 parent
4983b7ea1a
commit
7be7e53442
2 files changed
+24
-10
No files matched your search
@@ -1,10 +0,0 @@
|
||||
def summation(n):
|
||||
if n == 1:
|
||||
return 2
|
||||
inductive = summation(n - 1)
|
||||
|
||||
last_term = 2 * n
|
||||
return inductive + last_term
|
||||
|
||||
|
||||
print(summation(4))
|
||||
@@ -0,0 +1,24 @@
|
||||
in_data = input("Please enter 4-digit code: ")
|
||||
data_list = [char for char in in_data]
|
||||
d2 = data_list
|
||||
first_digit = 0
|
||||
second_digit = 0
|
||||
while True:
|
||||
first_digit = 0
|
||||
second_digit = 0
|
||||
in_guess = input("Please enter a guess or 0 to stop")
|
||||
guess_list = [char for char in in_guess]
|
||||
g2 = guess_list
|
||||
if in_guess[0] == "0":
|
||||
break
|
||||
for i, idx in enumerate(guess_list):
|
||||
print("index is", i, "idx is ", idx)
|
||||
if guess_list[i] == data_list[i]:
|
||||
g2[i] = ""
|
||||
d2[i] = ""
|
||||
list(filter(lambda a: a != "", g2))
|
||||
list(filter(lambda a: a != "", d2))
|
||||
|
||||
for i, idx in enumerate
|
||||
|
||||
print("Response: ", first_digit, second_digit)
|
||||
Reference in new issue
Block a user