0
Syntax error at the function header What is wrong? SOLVED 😊😊😊
The interpreter gives an error - Syntax error and points to the function header. I can’t understand what’s wrong. Maybe someone knows what needs to be done. amount = 10000 percent = 10 periods = 24 print("Будущая сумма вашего вклада составит:", calc_futureValue(amount, percent, periods) def calc_futureValue(amount, percent, periods): futureValue = amount * (1 + persent / 100) ** periods return futureValue https://code.sololearn.com/cQjuhSk8QwgC/?ref=app https://code.sololearn.com/cQjuhSk8QwgC/?ref=app
16 Respostas
+ 4
Елена Леващева I think the explanation here can help you find your mistakes
https://code.sololearn.com/c9wwa6DZ70XE/?ref=app
+ 1
First python reads code from up to down
2. In your function "persent" is not defined(you misspelled percent with persent)
3.you did not put your statements into a print function properly
https://code.sololearn.com/cLAs83wX3kae/?ref=app
+ 1
MATOVU CALEB Thank you very much. It is very kind of you to make such detailed explanation. That helps.
+ 1
Елена Леващева even this is valid
https://code.sololearn.com/cZ1D16rs6ZQJ/?ref=app
+ 1
https://code.sololearn.com/cB2DCA1hUHXT/?ref=app
+ 1
Елена Леващева You are not wasting my time. If you got any problem you are free to post it
0
MATOVU CALEB thanks a lot. I still can not see my mistakes 🤣🤣😃 I will correct my code
0
MATOVU CALEB Actually, I am trying to make my codes in functions when it is possible. I have just learned about the modularization method. So i mostly think about it. I tried to make above code in two functions too. But it didn't work 😔
0
Елена Леващева where are your codes?
0
MATOVU CALEB Hi, here it is. Actually variables like amount, percent etc are supposed to have the input function. But it doesn't work here at Sololearn
#code 2
def main():
amount = 10000
percent = 10
periods = 24
print("Будущая сумма вашего вклада составит:", calc_futureValue(amount, percent, periods))
def calc_futureValue(amount, percent, periods):
futureValue = amount * (1 + percent / 100) ** periods
return futureValue
main()
0
MATOVU CALEB thanks again, both codes work fine. So it seems that i made wrong order of my functions.
0
It seems that now my code also works at Sololearn. But it doesn't on my Pydroid3. Actually none of the above codes work on it (Pydroid3). Probably problem with it.
#code 2
def main():
amount = int(input())
percent = int(input())
periods = int(input())
print("Future value of the current amount is :", calc_futureValue(amount, percent, periods))
def calc_futureValue(amount, percent, periods):
futureValue = amount * (1 + percent / 100) ** periods
return futureValue
main()
0
MATOVU CALEB O, i got the problem i should have a rest and I am sorry for wasting your time
0
Now i know if a code does work then problem with my head only 😂😂😂