0

Can anyone help me with my code, I just cant seem to see the problem. I am new yo programming so it probably really easy to see.

I am using 4 birthday gifts as an example.

x = input("How many birthday gifts do you need to buy? ")
list = []

for gifts in range(int(x)):
    name= input("Enter Name: ")
    list.append(name)

print(list)

def budget (a,b,c,d):
    return budget(a,b,c,d*10)

a = len(list[0])
b = len(list[1])
c = len(list[2])
d = len(list[3])

budget(a,b,c,d*10)

print("The Budget for",list[0],"s gift is: ",a)
print("The Budget for",list[1],"s gift is: ",b)
print("The Budget for",list[2],"s gift is: ",c)
print("The Budget for",list[3],"s gift is: ",d)

my error code

How many birthday gifts do you need to buy? 4
Enter Name: lee
Enter Name: lee
lEnter Name: ee
Enter Name: lee
Traceback (most recent call last):
['lee', 'lee', 'lee', 'lee']
  File "C:/Users/Ethan/PycharmProjects/untitled1/Birthday Gift List.py", line 18, in <module>
    budget(a,b,c,d*10)
  File "C:/Users/Ethan/PycharmProjects/untitled1/Birthday Gift List.py", line 11, in budget
    return budget(a,b,c,d*10)
  File "C:/Users/Ethan/PycharmProjects/untitled1/Birthday Gift List.py", line 11, in budget
    return budget(a,b,c,d*10)
  File "C:/Users/Ethan/PycharmProjects/untitled1/Birthday Gift List.py", line 11, in budget
    return budget(a,b,c,d*10)
  [Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceeded
2beasty4u
  • 11
  • 1
  • 1

0 Answers0