Using Python Libraries || Type C || Sumita Arora || Class 12 || Computer science || Information practices || Solution ||

 

Q 1 = Write a Python program having following functions: 

(i) = A function with the following signature:    Remove_letter (sentence, letter) This function should take a string and a letter (as a single-character string) as arguments returning a copy of that string with every instance of the indicated letter removed for example remove_letter ("Hello there!", "e") should return the string "Hllo thr!". Try implementing it using <str>.split ( ) function. 

(ii) =Write a function to do the following :Try implementing the capwords () functionality using other functions, i.e , split(), capitalize () and join( ). Compare the result with the capwords() function's result.

 


               

Q 2 = Create a module lengthconversion.py that stores functions for various lengths conversion 

•    miletokm  ()  to convert miles to kilometers

•    kmtomile()   to convert kilometers to miles

•    feettoinches( ) 

•    inchestofeet()

It should also store constant values such as value of (mile in kilometers and vice versa). [I mile = 1.609344 kilometer ; 1 feet = 12 inches] Help( ) function should display proper information.





Q 3 = Create a module MassConversior.py that stores function for mass conversion e.g , 

•    A kgtotonne( ) to convert kg to tonnes

•    A tonnetokg() to convert tonne to kg

•    A kgtopound( ) to convert kg to pound

•    A poundtokg()to convert pound to kg

(Also store constants 1 kg - 0.001 tonne, 1 kg = 2.20462 pound) Help( ) function should give proper information about the module.



Q 4 = Create a package from above two modules as this:

Conversion

Length

Lengthconversion.py


Mass

                         Massconversion.py


Make sure that above package meets the requirements of being a Python package. Also, you should be able to import above package and/or its modules using import command.


 

12 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. plzz provide solutions for type b questions of this chapter

    ReplyDelete
    Replies
    1. PLEASE WAIT,IT WILL TAKE SOME TIME ......

      Delete
    2. But it is there brother!

      Delete
  2. Keep up the good work!

    ReplyDelete
  3. Thank you so much 🥰❤️

    ReplyDelete
  4. Thank you for your efforts , this website never fails to help me ....☺

    ReplyDelete
  5. Thanks a lot guruji for giving such helpful contents

    ReplyDelete
  6. how many people work on this platform?

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post