What am I doing wrong | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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