Advanced Python Programming Exercises

prefinal exercises sets dictionaries and object n.w
1 / 8
Embed
Share

Practice advanced Python programming concepts with exercises on sets, dictionaries, and object-oriented programming. Includes tasks such as working with sets and lists, manipulating dictionaries, and defining classes with attributes and methods.

  • Python Programming
  • Sets
  • Dictionaries
  • Object-Oriented Programming

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. PreFinal Exercises -- Sets,Dictionaries, and Object Oriented Programming

  2. Question-1 Write a function that asks user to enter 10 numbers and inserts the numbers to a Set. The function prints You already entered the number if user enters a number that it is entered before. After getting 10 distinct numbers function returns the set. You are allowed to use only Set data structure.

  3. Question-2 Write a function that gets two lists which contain numbers and returns the common numbers in the lists as a list. Use set data structure.

  4. Question-3 Write a function that gets four sets (A,B,C,D) and returns union of intersections of (A and B) and (B and D) as a set.

  5. Question-4 Write a function that gets a word-code dictionary and a string and returns coded string. So your function should return hallo wereld for hello world string and {hello:hallo, world:wereld} dictionary.

  6. Question-5 Write a function that gets two dictionaries(d1,d2) which map strings to numbers and returns union of these two dictionaries. If d1 and d2 have keys in common, the function should use the value in d1 in the union dictionary.

  7. Question-6 Define an Account class which has following private attributes and public methods; name ssn checking_balance Getters and setters of all attributes CWithdraw(amount) CDeposit(amount)

  8. Question-7 Define a XAccount class which is a subclass of Account class and has following private attributes and public methods; saving_balance Getters and setters of saving_balance savingWithDraw(amount) savingDeposit(amount) smart_withdraw(amount) -> Withdraws amount from checking balance but deposits 1% of the amount from checking to saving account. Use Account methods along with relevant XAccount methods.

Related


More Related Content