Loading ...
SeekhoCoding
Python Syllabus Game Python Projects

Chapter 6 : Python Functions (Practice Sets)

इस Web Page पर Python Functions से संबंधित Problems Add कि गई है | इस Web Page को add करने का उद्देश्य आपको Python Functions का अभ्यास कराने और आपकी Coding Skills को बेहतर बनाना है | किसी एक ही काम को बार - बार दोहराने के लिए Python मे Functions का उपयोग किया जाता है For Example पहले 1 और 5 का sum करना फिर 2 और 3 का इस तरह से एक ही काम को बार - बार दोहराने करने के लिए उस काम का Function Create कर दिया जाता है | हमने इस Web Page पर उपलब्ध Problems Python Functions के अनुकूल तैयार कि है , इसलिए इस Web Page पर दि गई Problems को solve करने से पहले Website पर उपलब्ध Function In Python chapter को जरूर पढ़े और नीचे दिए गए Problems/Questions को solve करे |

Problem 1 :

एक mall मे customer items purchase करता है हर item का अलग prise होता है और mall का system automatically final payable ammount calculate करके दे देता है | एक Program लिखे जो ,

  1. customer से input मे total purchase किए गए items की lenght ले |
  2. customer दवारा purchase किए गए सभी items prise input के रूप मे ले
  3. sale किए गए items पर 10 % की rate से discount calculate करे |
  4. Total sale Prise ammount से discount को substract करके total payable ammount निकाल के दे |

Python Loading...

Solution Program Explanation :

  1. def total_payable_amount(): = > total_payable_ammount नाम का एक function create किया गया है |
  2. n = int(input("")) = > n variable input मे Integer value को store करता है |
  3. prices = [] = > prices variable list type का data store करता है |
  4. for i in range(n): = > for loop n variable मे stored number तक एक - एक करके numbers को i variable मे store करता है |
  5. p = int(input(f"Item {i} price: ")) = > p variable input मे Integer values को store करता है |
  6. prices.append(p) = > p variable मे store values को prices variable मे add किया जा रहा है |
  7. total_ammount = sum(prices) = > prices variable मे stored स भी ammounts की sum value total_ammount variable मे stored है |
  8. total_discount = total_ammount * 0.10 = > total_ammount variable मे stored ammount को .10 से multiply value को total_discount variable मे store किया गया है |
  9. total_payable_ammount = total_ammount - total_discount = > total_payable_ammount variable मे total_ammount से total_discount को घटाने के बाद की value stored है |
  10. print("Total Amount:", total_ammount) = > ये print() function screen पर total_ammount variable मे stored value को show करता है |

11. print("Discount (10%):", total_discount) = > ये print() function screen पर total_discount variable मे stored value को show करता है |
12. print("Total Payable Amount:", total_payable_ammount) = > ये print() function screen पर total_payable_ammount variable मे stored value को show करता है |
13. total_payable_amount() = > total_payable_ammount function को call की गई है |

Problem 2 :

Teachers Daily Class wise Students की Attendance लेते है और हर year Percentage के Base पर school की total Attendance Percentage show करता है |
एक Python Function लिखे जो ,

  1. input मे total class ले |
  2. class wise total students और persent students ले |
  3. last मे total Percentage को show करे |

Python Loading...

Solution Program Explanation :

  1. def attendance_percentage(): = > attendance_percentage name का एक function create किया गया है |
  2. n = int(input("Total Classes : ")) = > n variable input मे Integer number को store करता है |
  3. total_classes = 0 = > total_classes variable मे 0 value store की गई है |
  4. total_present = 0 = > total_present variable मे 0 value store की गई है |
  5. for i in range(n): = > for loop n variable मे stored number तक एक - एक करके numbers को i variable मे store करता है |
  6. print(f"\nClass {i+1}") = > ये print() function i variable मे stored value मे 1 को add करके total value को show करता है |
  7. total , present = > दोनों variable input मे Integer value को store करते है |
  8. total_classes += total = > total variable मे total_classes variable मे stored value को add किया गया है |
  9. total_present += present = > present variable मे total_present variable मे stored value को add किया गया है |
  10. percentage = (total_present / total_classes) * 100 = > percentage variable मे total_present variable को total_classes variable से devide करने के बाद आई value को 100 से multiply करने के बाद की value stored है |

11. print("", total_classes) = > ये print() function screen पर total_classes variable मे stored value को show करता है |
12. print(" ", total_present) = > ये print() function screen पर total_present variable मे stored value को show करता है |
13. print(" ", percentage, "%") = > ये print() function screen पर percentage variable मे stored value को show करता है |
14. attendance_percentage() = > attendance_percentage function को call की गई है |

Problem 3 :

School मे Students Tables को Copies मे लिखते है Tables को याद करते है Teacher को Tables का test देते है |
Python मे एक function लिखे जो ,

  1. User से जिस number का Table create करना है उस number Input मे ले |
  2. Program enter किए गए Number की Table create करके show करे |

Python Loading...

Solution Program Explanation :

  1. def create_table(num): = > create_table नाम का function create किया गया है जिसमे num name का variable है |
  2. for i in range(1, 11): = > ये for loop एक - एक करके 1 से 11 तक के numbers को i variable मे store करता है |
  3. print(f"{num} x {i} = {num * i}") = > num variable मे stored number को i variable मे stored number से multiply करके table के format मे show किया गया है |
  4. create_table(5) = > create_table function को call किया गया है और 5 value को num variable मे store किया गया है |

Problem 4 :

बहुत से mobile apps , website , software पर password create करने के बाद automatically check किया जाता है कि enter किया गया Password एक strong Password है या नही | एक Function लिखे जो ,

  1. User से input मे कोई password ले |
  2. Enter किए गए Password की lenght Find करे |
  3. password की Lenght 8 से उपर है होने पर message show हो कि "This Is A Strong Password" है |
  4. password की Lenght 8 से उपर न है होने पर message show हो कि "This Is Not A Strong Password" है |
Python Loading...

Solution Program Explanation :

  1. def password_checker(): = > password_checker नाम का function create किया गया है |
  2. password = input(" ") = > password variable input मे value store करता है |
  3. if len(password) > 8: = > password variable मे stored value की lenght 8 से कम होने पर ये if statement True होती है |
  4. password_checker() = > password_checker function को call की गई है |

Problem 5 :

students अपने सभी achieved marks का sum करके total marks को number of subjects से devide करके average value प्राप्त करते है |
एक Python Function लिखे जो ,

  1. Student से Number of subjects ले |
  2. सभी subjects मे प्राप्त Marks ले |
  3. प्राप्त किए गए Marks की average value show करे |
Python Loading...

Solution Program Explanation :

  1. def find_average(): = > find_average नाम का function create किया गया है |
  2. n = int(input(")) = > n variable मे Numbers of total subject को store किया जाता है |
  3. total = 0 = > total variable मे 0 value store की गई है |
  4. for i in range(n): = > ये for loop n variable मे stored number तक के सभी numbers को एक - एक करके i variable मे store करता है |
  5. num = int(input(f"{i+1}")) = > num variable input मे Integer value को store करता है |
  6. total += num = > num variable मे stored value को total variable मे add किया गया है |
  7. average = total / n = > total variable मे stored value को n variable मे stored value से devide करने के बाद की value average variable मे store की गई है |
  8. print("", average) = > ये print() function Screen पर average variable को show करता है |
  9. find_average() = > find_average function को call/run किया गया है |

Problem 6 :

Mathematics मे Teacher Students से किसी Number को पूछता है कि ये even Number है या odd number है student number को 2 से devide करता है reminder 0 के बराबर होन पर even Number वरना odd Number
नीचे दिए गए code editor मे एक function लिखे जो ,

  1. User से Input के रूप मे कोई Numbers ले |
  2. User दवारा enter किए गए Numbers को check करे |
  3. बताए कि एक Number even number है या odd number
Python Loading...

Solution Program Explanation :

  1. def number_checker(): = > number_checker एक Function है |
  2. num = int(input(" ")) = > num variable input मे Integer value को store करता है |
  3. if num % 2 == 0: = > num variable मे stored value को 2 से devide करने के बाद reminder 0 के बराबर होने पर ये if statement True होती है |
  4. print("Even Number") = > ये print() function if statement के True होने पर screen पर Even Number message को show करता है |
  5. else : else statement if statement के false होने के बाद true होगी |
  6. print("odd Number") = > ये print() function else के True हो ने के बा द screen पर odd Number message show करता है |
  7. number_checker() = > number_checker function को call की गई है |

Problem 7 :

Schools मे students Special number Devidation game खेलते है game मे पहले student को एक number दिया जाता है जैसे : 5 , फिर turn by turn student ऐसा number बताते है जो 5 से devisible हो |
नीचे दिए गए code editor मे एक function लिखे जो ,

  1. User से Input के रूप मे कोई दो Numbers ले |
  2. first Number से Last Number के बीच उन सभी Numbers को show करे जो 5 से devisible हो |
Python Loading...

Solution Program Explanation :

  1. def number_devidation(): = > number_devidation नाम का Function create किया गया है |
  2. first_num = int(input(" ")) Last_num = int(input(" ")) = > first_num औ र Last_num दो variables है जो input मे Integer value को store करते है |
  3. for i in range(first_num , Last_num): = > for loop first_num variable से Last_num तक के numbers को i variable मे store करता है |
  4. i += 1 = > i variable मे 1 को add किया गया है |
  5. if i % 5 == 0: i variable मे stored value को 5 से devide करने के बाद reminder 0 के बराबर होने पर ये if statement True होती है |
  6. print(f" " , i) = > ये print() i variable को print करता है |
  7. number_devidation() = > number_devidation function को call की गई है |

Problem 8 :

School मे Student , घर पर kids etc. Time के according अभिवादन करते है जैसे : सुबह - सुबह good Morning करना |
नीचे दिए गए Code Editor मे एक Function लिखे जो ,

  1. जो time के अनुसार Greet show करे |

Python Loading...

Solution Program Explanation :

  1. from datetime import datetime = > live timing के लिए datetime Module को import किया गया है |
  2. def greet(): = > greet name का function create किया गया है |
  3. hour = datetime.now().hour = > hour variable मे live hour को store किया गया है |
  4. greet() = > greet function को call की गई है |

You have completed This Chapter ! 🎉

Now you can choose any one of the following options to test your knowledge :

💻

Code Practice

Solve practical exercises .

Practice Now
🏆

Knowledge Test

Answer the questions of the chapter .

Start Test
📘

Next Chapter

Continue your Python journey by reading the next chapter.

Next Chapter
🆘

Help Center

Users and we all help you together .

Peer Learning
Expert Advice
Live Chat
Fast Solutions