+ 1

What am I doing wrong

I am trying to determine the total price of 5 tickets using the youngest personā€™s age as the discount, but Iā€™m stuck. My Code: https://code.sololearn.com/cKK3Q5P2x9OU/?ref=app Its saying smallest hasnā€™t been declared, but I thought I did that, Iā€™ve tried a few things but I canā€™t figure out what Iā€™m doing wrong.

9th Jun 2022, 6:47 PM
melody knight
2 Answers
+ 3
Declare smallest before outside if block. Or close if block after print smallest.. Variable declared within a block belong to that block only.. It's a local scope in that block. Outside of it not available..
9th Jun 2022, 6:51 PM
Jayakrishna šŸ‡®šŸ‡³
+ 2
Thank you JayakrishnašŸ‡®šŸ‡³, I actually managed to figure that out right after posting my question. lol
9th Jun 2022, 6:55 PM
melody knight