0

What's wrong in this code ? Plzz can anyone correct it for me ?

https://code.sololearn.com/c8eycgVrau9d/?ref=app

8th Sep 2018, 4:44 PM
Vijay Sapkal
Vijay Sapkal - avatar
7 Réponses
+ 4
there are many errors in this code: 1.u compared int with string which always return False so only else part is always execute 2.if u wanna used 'amount' in ur function , u have to globally accessed before using in print statement like this def funcname(): global amount print(amount)
8th Sep 2018, 4:55 PM
Shruti
Shruti - avatar
+ 2
Remove the quotes in lines 21 and 23. You have converted the values to integers at input time.
8th Sep 2018, 5:02 PM
Paul
Paul - avatar
+ 2
As Paul Jacobs said u have to remove quotes and In. function u have to globally referenced the 'amount' variable, that's it.
8th Sep 2018, 5:18 PM
Shruti
Shruti - avatar
+ 2
Add the second line to both functions: def keti(): global amount if payf=="y": ........ def keti2(): global amount if payf=="y":
8th Sep 2018, 5:37 PM
Paul
Paul - avatar
+ 1
thanks Paul and Shruti...it worked !
8th Sep 2018, 5:57 PM
Vijay Sapkal
Vijay Sapkal - avatar
0
will u plz write the code for me ?
8th Sep 2018, 4:57 PM
Vijay Sapkal
Vijay Sapkal - avatar
0
done....but it is still not working!
8th Sep 2018, 5:23 PM
Vijay Sapkal
Vijay Sapkal - avatar