def list_life_aspects(aspects, current_index=0):
if current_index == len(aspects):
return
else:
print(aspects[current_index])
list_life_aspects(aspects, current_index + 1)
# Define a list of life aspects
life_aspects = ["Soccer", "School", "Sleep", "Biking", "Reading", "Gaming"]
# Call the function to list life aspects recursively
list_life_aspects(life_aspects)
Soccer
School
Sleep
Bikinng
Reading
Gaming
# Function to find a number in the fibonacci sequence..
def fibonacci(x):
if x == 1:
return(0) # First terminating statement
if x == 2:
return(1) # Second terminating statement
else:
return(fibonacci(x-1)+ fibonacci(x-2)) # We use recursion to recursively find sequential fibonacci sequence numbers.
for i in range(8):
print(fibonacci(i+1))
0
1
1
2
3
5
8
13