Fixat explicit import av 'mock' så att den faktiskt hittas

This commit is contained in:
Joakim Persson
2024-07-12 15:28:01 +02:00
parent e8d83cd693
commit 5e25aca23b
2 changed files with 53 additions and 37 deletions
+13 -1
View File
@@ -1,4 +1,9 @@
import io
def hanoi(n, source, auxiliary, target):
if n < 1:
print(f"No disks, nothing to do")
return
if n == 1:
print(f"Move disk 1 from {source} to {target}")
return
@@ -13,5 +18,12 @@ def hanoi(n, source, auxiliary, target):
# hanoi(3, 'A', 'B', 'C')
if __name__== "__main__":
hanoi(3,'A','B','C')
user_input = input("Please enter an integer: ")
try:
user_integer = int(user_input)
print(f"You entered the integer: {user_integer}")
except ValueError:
print("That's not a valid integer. Please try again.")
hanoi(user_integer,'A','B','C')