+ 3
My program says memory limit exceeded what should i do
i wrote few lines of codes which asks for user name and age then it calculates his/her age in years,moths,weeks,days,hours etc..but every time i enter user data it brings memory limit exceeded please help.. https://code.sololearn.com/cK2Yw5IgEVUo/?ref=app
2 Respostas
+ 8
Replace age=input("please enter your age\n") with age=int(input("please enter your age\n")). Otherwise it will be a string and you produce extremely long strings with your multiplications. In python, 5 * "x" is "xxxxx". Imagine what 12*4*7*24*60*60*age does if age is a string.
P. S. Also, remove the †ħAǸĸ$. It will break the code due to its non-standard encoding
+ 1
thnks anna
i cnt blv it oz little things which give all that headache :::::