0% found this document useful (0 votes)
5 views2 pages

Class12 Application Based Python Functions Worksheet

This worksheet contains five programming tasks focused on user-defined Python functions, each worth 4 marks. The tasks include creating an electricity bill calculator, a student result analyzer, an ATM cash withdrawal system, an online shopping discount calculator, and a hospital BMI checker. Additionally, there is a challenge task to modify one of the programs using return statements, a menu-driven approach, or multiple functions.

Uploaded by

akgaming24854
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Class12 Application Based Python Functions Worksheet

This worksheet contains five programming tasks focused on user-defined Python functions, each worth 4 marks. The tasks include creating an electricity bill calculator, a student result analyzer, an ATM cash withdrawal system, an online shopping discount calculator, and a hospital BMI checker. Additionally, there is a challenge task to modify one of the programs using return statements, a menu-driven approach, or multiple functions.

Uploaded by

akgaming24854
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Class12CBSEComputerScience

Application-BasedPython Functions Worksheet


Topic: Python Functions
TotalQuestions: 5 Marks:20
Instructions
 WritePythonprogramsusinguser-defined functions(def).
 Usepropervariablenamesand indentation.
 Displaymeaningfuloutputmessages.
 Eachquestioncarries4 marks.
1. ElectricityBill Calculator
WriteaPythonfunctionbil (units) tocalculatetheelectricitybillbasedonthefollowing
conditions:
-First100units→₹2perunit
-Next100units→₹3perunit
-Above200units→₹5perunit
Theprogramshould:
-Acceptthenumberofunitsconsumedfromtheuser
-Call thefunction
-Displaythetotal electricity bill
2. Student ResultAnalyzer
WriteaPythonfunctionresult(mark1, mark2, mark3, mark4,mark5)that:
-Calculatesthetotalmarks
-Calculatestheaverage
-Displays“Pass” if averageis greaterthanorequalto40
-Otherwisedisplays“Fail”
Theprogramshould acceptmarksof5 subjectsfromtheuser.
3. ATM Cash Withdrawal System
WriteaPythonfunctionwithdraw(balance, amount) that:
-Checkswhetherthewithdrawalamountis lessthanorequalto thebalance
-Deductstheamountif possible
-Displaystheremainingbalance
-Otherwisedisplays“InsufficientBalance”
Accepttheaccountbalanceand withdrawalamountfromtheuser.
4. OnlineShopping Discount Calculator
WriteaPythonfunctiondiscount(price) thatcalculatesthefinal amountafterdiscount.
DiscountConditions:
-Purchaseabove₹5000→20%discount
-Purchaseabove₹2000→10%discount
-Otherwise→Nodiscount
Theprogramshould:
-Acceptthepurchaseamount
-Displaythediscountamountandfinal bill
5. Hospital BMIChecker
WriteaPythonfunctionbmi(weight,height)tocalculateBodyMassIndex usingthe
formula:
BMI =weight/ (height*height)
Thefunctionshould display:
-“Underweight”ifBMI<18.5
-“Normal”if BMIisbetween18.5and24.9
-“Overweight”if BMI is 25orabove
Theprogramshould acceptweight(inkg)and height(inmeters)fromtheuser.
ChallengeTask
Modify any oneoftheaboveprogramsusing:
-Returnstatement
-Menu-drivenapproach
-Multiplefunctions

You might also like