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

30th Nov 2021, 5:21 AM
Елена Леващева
Елена Леващева - avatar
16 Réponses
+ 4
Елена Леващева I think the explanation here can help you find your mistakes https://code.sololearn.com/c9wwa6DZ70XE/?ref=app
30th Nov 2021, 5:56 AM
MATOVU CALEB
MATOVU CALEB - avatar
+ 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
30th Nov 2021, 5:31 AM
MATOVU CALEB
MATOVU CALEB - avatar
+ 1
MATOVU CALEB Thank you very much. It is very kind of you to make such detailed explanation. That helps.
30th Nov 2021, 1:28 PM
Елена Леващева
Елена Леващева - avatar
1st Dec 2021, 9:18 AM
MATOVU CALEB
MATOVU CALEB - avatar
+ 1
https://code.sololearn.com/cB2DCA1hUHXT/?ref=app
1st Dec 2021, 11:46 AM
MATOVU CALEB
MATOVU CALEB - avatar
+ 1
Елена Леващева You are not wasting my time. If you got any problem you are free to post it
1st Dec 2021, 12:09 PM
MATOVU CALEB
MATOVU CALEB - avatar
0
MATOVU CALEB thanks a lot. I still can not see my mistakes 🤣🤣😃 I will correct my code
30th Nov 2021, 5:44 AM
Елена Леващева
Елена Леващева - avatar
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 😔
30th Nov 2021, 1:38 PM
Елена Леващева
Елена Леващева - avatar
0
Елена Леващева where are your codes?
30th Nov 2021, 3:04 PM
MATOVU CALEB
MATOVU CALEB - avatar
1st Dec 2021, 6:34 AM
Елена Леващева
Елена Леващева - avatar
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()
1st Dec 2021, 6:38 AM
Елена Леващева
Елена Леващева - avatar
0
MATOVU CALEB thanks again, both codes work fine. So it seems that i made wrong order of my functions.
1st Dec 2021, 11:23 AM
Елена Леващева
Елена Леващева - avatar
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()
1st Dec 2021, 11:40 AM
Елена Леващева
Елена Леващева - avatar
0
MATOVU CALEB O, i got the problem i should have a rest and I am sorry for wasting your time
1st Dec 2021, 12:00 PM
Елена Леващева
Елена Леващева - avatar
0
Now i know if a code does work then problem with my head only 😂😂😂
1st Dec 2021, 12:05 PM
Елена Леващева
Елена Леващева - avatar