Computer Science (083): Python Important Programs for final practical

  1. Calculations
    1. Write program to input any number and to print all factors of that number.
    2. Write a program to input any number and to check whether given number is Armstrong or not. (Armstrong 1,153,etc. 13 =1 , 13+53 +33 =153)
    3. Write a program to input employee no, name basic pay and to find HRA, DA and netpay.
      Basic pay                   Hra Da
      >100000                   15% 8%
      <=100000&>50000 10% 5%
      <=50000                   5% 3%
    4. Write a program to find all prime numbers up to given number.
    5. Write a program to convert decimal number to binary.
    6. Write a program to convert binary to decimal.
    7. Write a program to input two complex numbers and to find sum of the given complex numbers.
    8. Write a program to input two complex numbers and to implement multiplication of the given complex numbers.
    9. Write a program to find sum of two distances with feet and inches.
    10. Write a program to find difference between two times with hours, minutes and seconds.
    11. Write a program to find the sum of all digits of the given number.
    12. Write a program to find the reverse of that number
  2. Strings
    1. Write a program to input username and password and to check whether the given username and password are correct or not.
    2. Which string method is used to implement the following:
      a) To count the number of characters in the string.
      b) To change the first character of the string in capital letter.
      c) To check whether given character is letter or a number.
      d) To change lower case to upper case letter.
      e) Change one character into another character.
    3. Write a program to input any string and to find number of words in the string.
    4. Write a program to input any two strings and to check whether given strings are equal are not.
  3. Lists/Tuple/Dictionary
    1. Write a program to input n numbers and to insert any number in a particular position.
    2. Write a program to input n numbers and to search any number.
    3. Sorting
  4. OOP
    1. Write a program to find area of following using function overloading.
      1. Area of circle (function with one parameter)
      2. Area of rectangle (function with two parameters)
      3. Area of triangle (function with three parameters)
    2. Write a program to find out volume of the following using function overloading.
      1. volume of cube
      2. volume of cuboid
      3. volume of cylinder
    3. Create the class SOCIETY with following information:
      society_name
      house_no
      no_of_members
      flat
      income
      Methods
      An __init__ method to assign initial values of society_name as "Surya Apartments", flat as "A Type", house_no as 20, no_of_members as 3, income as 25000.
      Inputdata( ) - to read data members (society, house_no, no_of_members & income) and call allocate_flat().
      allocate_flat( ) - To allocate flat according to income
      Income                          Flat
      >=25000                      A Type
      >=20000 and <25000 B Type
      <15000                        C Type
      Showdata( ) - to display the details of the entire class.
    4. Define a class ITEMINFO in Python with the following description:
      ICode (Item Code)
      Item (Item Name)
      Price (Price of each item)
      Qty (quantity in stock)
      Discount (Discount percentage on the item)
      Netprice (Final Price)
      A member function FindDisc( ) to calculate discount as per the following rule:
      If Qty<=10 Discount is 0
      If Qty (11 to 20) Discount is 15
      If Qty>=20 Discount is 20
      A constructor( __init__ method) to assign the value with 0 for ICode, Price, Qty, Netprice and Discount and null for Item respectively
      A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty and call function FindDisc( ) to calculate the discount and Netprice(Price*Qty-Discount).
      A Function ShowAll( ) to allow user to view the content of all the data members.
    5. Define a class furniture in Python with the given specifications:
      Instance variables:
      Type
      Model
      Methods
      getType() To return instance variable Type
      getModel()To return instance variable Model
      show() To print instance variable Type and Model
      Define a class sofa:
      No_of_seats
      Cost
      getSeats() To return instance variable No_of_seats
      getCost() To return instance variable Cost
      show() To print instance variable No_of_seats and Cost
      This class inherits class furniture
    6. Define a class student in Python with the given specifications:
      Instance variables:
      Roll number, name
      Methods:
      Getdata()- To input roll number and name
      Printdata()- To display roll number and name
      Define another class marks, which is derived from student class
      Instance variable
      Marks in five subjects
      Methods:
      Inputdata() - To call Getdata() and input 5 subjects marks.
      Outdata() - To call printdata() and to display 5 subjects marks.
  5. File Handling
    1. Creating copy of a file.
    2. Write a function that takes three argument 1st input file, 2nd output file and 3rd transformation function. First argument is the file opened for reading, second argument is the file opened for writing
      and third argument is a function, which takes single string and performs a transformation of your choice and returns the transformed string. The function should reed each line in the input file, pass
      the line through transformation function and then write transformed line to output file. A transformation can be - capitalize first alphabet of every word.
    3. Write a function to create a text file containing following data
      Neither apple nor pine are in pineapple. Boxing rings are square.
      Writers write, but fingers don't fing. Overlook and oversee are opposites. A house can burn up as it burns down. An alarm goes off by going on.
      i) Read back the entire file content using read() or readlines () and display on screen.
      ii) Append more text of your choice in the file and display the content of file with line numbers
      prefixed to line.
      iii) Display last line of file.
      iv) Display first line from 10th character onwards
      v) Read and display a line from the file. Ask user to provide the line number to be read.
    4. Create a dictionary having decimal equivalent of roman numerals. Store it in a binary file. Write a function to convert roman number to decimal equivalent using the binary file data.
    5. Write a program to delete the content provided by user from the binary file. The file is very large and can't fit in computers memory.
    6. Write a program to read a file 'Story.txt' and create another file, storing an index of Story.txt telling which line of the file each word appears in. If word appears more than once, then index should show all the line numbers containing the word.
      Hint : Dictionary with key as word(s) can be used to solve this.
    7. Write a function called replace file(), that takes pattern string, replacement string and two file names as argument. The function should read the first file and write the content into second file (creating it, if necessary). If the pattern string appear anywhere in first file, it should be replaced by replacement string in second file.
    8. Write a program to accept a filename from the user and display all the lines from the file which contain python comment character '#'.
    9. Reading a file line by line from beginning is a common task, what if you want to read a file backward. This happens when you need to read log files. Write a program to read and display content of file from end to beginning.
    10. Create a class item to store information of different items, existing in a shop. At least following is to be stored w.r.t. each item code, name, price, qty. Write a program to accept the data from user and store it permanently in the file. Also provide user with facility of searching and updating the data in file based on code of item.

30 comments:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Data Science with Python , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Sangita Mohanty
    MaxMunus
    E-mail: sangita@maxmunus.com
    Skype id: training_maxmunus
    Ph:(0) 9738075708 / 080 - 41103383
    http://www.maxmunus.com/

    ReplyDelete
    Replies
    1. Hello Navadeep,


      Gratitude for putting up this prolific article! You truly make everything a cake walk. Genuinely good stuff, saving time and energy.

      I am new to python. I am trying trying to use it for the problem as follows:
      I have one file with 3 coloums of 32 bit data in hex representation. Second file is also 3 coloums but showing only one or two bits in binary representation that is my look up table.

      A higher-order function accepts one or more functions as input and returns a new function. Sometimes it is required to use function as data. To make high order function, we need to import functools module The functools.partial() function is used often for high order function.

      Comparing two files records in such a way that on each iteration from first file picking one combination of bits (2bits) for 3 fields in record compare them to record in look up table I.e file 2.
      E.g
      File 1 record hex:
      A8000001 0000000 64000000

      File 2 data binary :
      10 00 01
      One iteration picks 01 compares to file2 first coloums data I.e 10 then file 1,2nd coloums 2 bits 00 with 2nd file 2nd coloums in same row it's 00. So on.
      Kindly suggest a solution or a hint how to implement it.


      It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
      Keep up the good work!


      Thanks,
      Henrik

      Delete
  2. I feel really happy to have seen your webpage and look forward to so
    many more entertaining times reading here. Thanks once more for all
    the details. Besant technology offer Python training in Bangalore

    ReplyDelete
  3. Thanks for one marvelous posting! I enjoyed reading it; you are a great
    author. I will make sure to bookmark your blog and may come back
    someday. I want to encourage that you continue your great posts, have
    a nice weekend!



    Selenium Training in Chennai

    ReplyDelete
  4. My rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends.

    Java Training in Bangalore|

    ReplyDelete
  5. My rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends. DevOps Training in Bangalore

    ReplyDelete
  6. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

    AWS training in bangalore

    ReplyDelete
  7. Nice information provided but i wanted to learn AWS from the starting and wanted to learn online.anybody want to study visit us this website .
    AWS Training in Bangalore

    ReplyDelete
  8. Excellent Python Preparation
    Thank you for sharing please keep updating more on Python:
    Devops Training in Bangalore

    ReplyDelete
  9. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Besant technologies Marathahalli

    ReplyDelete
  10. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    Selenium Training in Chennai

    Selenium Training in Porur

    ReplyDelete





  11. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

    Automation Anywhere Training in Chennai

    ReplyDelete
  12. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.


    amazon web services training in bangalore

    ReplyDelete
  13. Thank you for the informative post. It was thoroughly helpful to me. Python Training in Hyderabad

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Sap fico training institute in Noida

    Sap fico training institute in Noida - Webtrackker Technology is IT Company which is providing the web designing, development, mobile application, and sap installation, digital marketing service in Noida, India and out of India. Webtrackker is also providing the sap fico training in Noida with working trainers.


    WEBTRACKKER TECHNOLOGY (P) LTD.
    C - 67, sector- 63, Noida, India.
    F -1 Sector 3 (Near Sector 16 metro station) Noida, India.

    +91 - 8802820025
    0120-433-0760
    0120-4204716
    EMAIL: info@webtrackker.com
    Website: www.webtrackker.com

    ReplyDelete
  16. Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
    AWS Training in Chennai
    Data Science Training in Chennai
    Python Training in Chennai

    ReplyDelete
  17. Really Good blog post provided helpful information. I hope that you will post more updates like this...
    Python Training Classes in Noida
    C C++ Training Institutes in Noida

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    If you are looking for any Data science Related information please visit our website Data science courses in Pune page!

    ReplyDelete
  20. Thank you so much for sharing this useful information.It is very attractive.keep posting more.Visit our site for any courses
    data science training institutes in bangalore

    ReplyDelete
  21. Thanks for all your wonderful articles and Comments,Really I feel happy to see this useful blog...Looking towards more and more...Advance Thanks for many more updates...
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  22. Very excellent post!!! Thank you so much for your great content. Keep posting.....

    Tableau Training in Pune
    Tableau Training Institutes in Pune

    ReplyDelete
  23. Let these Thursday quotes start your day on a positive note. Share them with those who feel like the week is never going to end; give them a bit of . Happy Thursday Pictures

    ReplyDelete