Find the final train ticket | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Find the final train ticket

If male and Sr citizen, 70%fare is applicable. If female & Sr citizen,50% fare is applicable. if female & normal citizen, 70% fare is applicable. If male & normal citizen, 100% of fare is applicable. How to do python code for this ? Can anyone help me out ?

9th Dec 2022, 6:20 AM
Anu
Anu - avatar
1 Answer
+ 1
Made a class person with attributes gender, citizenship. Accept input for these and set values. Depending on the values calculate fair as per description. Print result. You can do it without class and with just a method also. Or even without method. What is the actual normal price? If price = 100 , then input are Make, Sr citizen then 70% fair is 100*70/100 = 70 is fair. You can determine Seniority depending on age also, if input is age.. Try it yourself and post your attempt if not successful... Hope it helps...
9th Dec 2022, 7:55 AM
Jayakrishna 🇮🇳