├── .gitignore ├── README.md ├── python-advanced ├── 01 - Lists as Stacks and Queues - Exercise │ ├── 01-Lists-as-Stacks-and-Queues-Exercise.docx │ ├── 01. Reverse Numbers with a Stack.py │ ├── 02. Maximum and Minimum Element.py │ ├── 03. Fast Food.py │ ├── 04. Fashion Boutique.py │ ├── 05. Truck Tour.py │ ├── 06. Balanced Parentheses.py │ └── 07. Robotics.py ├── 01 - Lists as Stacks and Queues - Lab │ ├── 01-Lists-as-Stacks-and-Queues-Lab.docx │ ├── 01. Reverse Strings.py │ ├── 02. Matching Parentheses.py │ ├── 03. Supermarket.py │ ├── 04. Water Dispenser.py │ └── 05. Hot Potato.py ├── 02 - Tuples and Sets - Exercise │ ├── 01. Unique Usernames.py │ ├── 02-Tuples-and-Sets-Exercise.docx │ ├── 02. Sets of Elements.py │ ├── 03. Periodic Table.py │ ├── 04. Count Symbols.py │ ├── 05. Phonebook.py │ ├── 05. Phonebook_updated.py │ ├── 06. Longest Intersection.py │ └── 07. Battle of Names.py ├── 02 - Tuples and Sets - Lab │ ├── 01. Count Same Values.py │ ├── 02-Tuples-and-Sets-Lab.docx │ ├── 02. Average Student Grades.py │ ├── 03. Record Unique Names.py │ ├── 04. Parking Lot.py │ └── 05. SoftUni Party.py ├── 03 - Multidimensional Lists - Exercise │ ├── 01. Diagonal Difference.py │ ├── 02. 2x2 Squares in Matrix.py │ ├── 03-Multidimensional-Lists-Exercise.docx │ ├── 03. Maximum Sum.py │ ├── 04. Matrix Shuffling.py │ ├── 05. Snake Moves.py │ ├── 06. Knight Game.py │ ├── 06. Knight Game_oop.py │ ├── 07. Bombs.py │ ├── 07. Bombs_OOP.py │ ├── 08. Miner.py │ └── 09. Radioactive Mutant Vampire Bunnies.py ├── 03 - Multidimensional Lists - Lab │ ├── 01. Sum Matrix Elements.py │ ├── 02. Sum Matrix Columns.py │ ├── 03-Multidimensional-Lists-Lab.docx │ ├── 03. Primary Diagonal.py │ ├── 04. Symbol in Matrix.py │ └── 05. Square with Maximum Sum.py ├── 04 - Comprehensions - Exercise │ ├── 01. Word Filter.py │ ├── 02. Words Lengths.py │ ├── 03. Capitals.py │ ├── 04-Comprehensions-Exercise.docx │ ├── 04. Number Classification.py │ ├── 05. Diagonals.py │ ├── 06. Matrix of Palindromes.py │ ├── 07. Flatten Lists.py │ ├── 08. Heroes Inventory.py │ ├── 09. Bunker.py │ └── 10. Matrix Modification.py ├── 04 - Comprehensions - Lab │ ├── 01. ASCII Values.py │ ├── 02. No Vowels.py │ ├── 03. Even Matrix.py │ ├── 04-Comprehensions-Lab.docx │ ├── 04. Flattening Matrix.py │ └── 05. Filter Numbers.py ├── 05 - Functions Advanced - Exercise │ ├── 01. Even Numbers.py │ ├── 02. Sort.py │ ├── 03. Min Max and Sum.py │ ├── 04. Negative vs Positive.py │ ├── 05-Functions-Advanced-Exercise.docx │ ├── 06. Arguments Length.py │ ├── 07. Concatenate.py │ ├── 08. Even or Odd.py │ ├── 09. Function Executor.py │ ├── 10. Keyword Arguments Length.py │ ├── 11. Age Assignment.py │ ├── 12. Recursion Palindrome.py │ └── 13. Recursive Power.py ├── 05 - Functions Advanced - Lab │ ├── 01. Absolute Values.py │ ├── 02. Rounding.py │ ├── 03. Multiplication Function.py │ ├── 04. Operate.py │ ├── 05-Functions-Advanced-Lab.docx │ ├── 05. Person Info.py │ ├── 06. Character Combinations.py │ ├── 07. Chairs.py │ └── 08. Expressions.py ├── 06 - File Handling - Exercise │ ├── 01. Even Numbers.py │ ├── 02. Line Numbers.py │ ├── 03. File Manipulator.py │ ├── 04. Directory Traversal.py │ ├── output.txt │ └── text.txt ├── 07 - Modules - Exercise │ └── shop │ │ ├── __init__.py │ │ ├── authentification.py │ │ ├── canvas.py │ │ ├── db │ │ ├── currenr_user.txt │ │ ├── img │ │ │ ├── 01.jpg │ │ │ └── 02.jpg │ │ ├── products.txt │ │ ├── user_credentials.txt │ │ └── users.txt │ │ ├── helpers.py │ │ ├── main.py │ │ └── products.py ├── 10 - Error Handling - Exercise │ ├── 01. Numbers Dictionary.py │ ├── 02. Email Validator.py │ └── 10-Error-Handling-Exercise.docx ├── ZZ - Exam - Prep │ ├── 14 April 2021 │ │ ├── 01. Problem_Условие.docx │ │ ├── 01.py │ │ ├── 01_oop.py │ │ ├── 02. Problem_Условие.docx │ │ ├── 02.py │ │ ├── 02_oop.py │ │ ├── 03. Problem_Условие.docx │ │ └── 03.py │ ├── 14 February 2021 │ │ ├── 01.py │ │ ├── 01_oop.py │ │ ├── 02.py │ │ ├── 02_alt.py │ │ ├── 03.py │ │ ├── Problem 1_Условие.docx │ │ ├── Problem 2_Условие.docx │ │ └── Problem 3_Условие.docx │ ├── 16 Dec 2020 │ │ ├── 01.py │ │ ├── 01_alt.py │ │ ├── 02.py │ │ ├── 02_alt.py │ │ ├── 03.py │ │ ├── 03_alt.py │ │ ├── Problem 1_Problem Description.docx │ │ ├── Problem 2_Problem Description.docx │ │ └── Problem 3_Problem Description.docx │ ├── 19 August 2020 │ │ ├── 01. Taxi Express_Description.docx │ │ ├── 01.py │ │ ├── 01_alt.py │ │ ├── 02. Minesweeper Generator_Description.docx │ │ ├── 02.py │ │ ├── 02_alt.py │ │ ├── 03. Numbers Search_Description.docx │ │ ├── 03.py │ │ └── 03_alt.py │ ├── 24 October 2020 │ │ ├── 01. Scheduling_Условие.docx │ │ ├── 01.py │ │ ├── 02. Checkmate_Условие.docx │ │ ├── 02.py │ │ ├── 02_alt.py │ │ ├── 03. List Pureness_Условие.docx │ │ └── 03.py │ └── 27 June 2020 │ │ ├── 01. Bombs_Description.docx │ │ ├── 01.py │ │ ├── 02. Snake_Description.docx │ │ ├── 02.py │ │ ├── 03. List Manipulator_Description.docx │ │ └── 03.py └── ZZ - Exam │ ├── 01.py │ ├── 02.py │ └── 03.py ├── python-basics └── Exam │ ├── 01. Programming Book_Условие.docx │ ├── 01_exam.py │ ├── 02. Spaceship_Условие.docx │ ├── 02_exam.py │ ├── 03. Computer Room_Условие.docx │ ├── 03_exam.py │ ├── 04. Cat Food_Условие.docx │ ├── 04_exam.py │ ├── 05. Christmas Gifts_Условие.docx │ ├── 05. Series.docx │ ├── 05_exam.py │ ├── 06. Gold Mine_Условие.docx │ ├── 06_exam.py │ └── README.md ├── python-fundamentals ├── .gitattributes ├── 01 Basic Syntax, Conditional Statements and Loops - Exercise │ ├── 01-Basic-Syntax-Conditional-Statements-and-Loops-Exercise.docx │ ├── 01. Jenny's Secret Message.py │ ├── 02. Drink Something.py │ ├── 03. Leonardo DiCaprio Oscars.py │ ├── 04. Double Char.py │ ├── 05. Can't Sleep Count Sheep.py │ ├── 06. Next Happy Year.py │ ├── 07. Maximum Multiple.py │ ├── 08. Mutate Strings.py │ ├── 09. Easter Cozonacs.py │ └── 10. Christmas Spirit.py ├── 01 Basic Syntax, Conditional Statements and Loops - Lab │ ├── 01-Basic-Syntax-Conditional-Statements-and-Loops-Lab.docx │ ├── 01. Biggest Of Three Numbers.py │ ├── 02. Number Definer.py │ ├── 03. Word Reverse.py │ ├── 04. Number Between 1 and 100.py │ └── 05. Patterns.py ├── 01 Basic Syntax, Conditional Statements and Loops - More-Exercise │ ├── 01-Basic-Syntax-Conditional-Statements-and-Loops-More-Exercise.docx │ ├── 01. Find the Largest.py │ ├── 02. Find The Capitals.py │ ├── 03. Wolf In Sheep's Clothing.py │ ├── 04. Sum Of A Beach.py │ └── 05. How Much Coffee Do You Need.py ├── 02 Data Types and Variables - Exercises │ ├── 01. Integer Operations.py │ ├── 02. Chars to String.py │ ├── 02. Data-Types-and-Variables-Exercises.docx │ ├── 03. Elevator.py │ ├── 04. Sum of Chars.py │ ├── 05. Print Part of the ASCII Table.py │ ├── 06. Triples of Latin Letters.py │ ├── 07. Water Overflow.py │ ├── 08. Party Profit.py │ ├── 09. Snowballs.py │ └── 10. Gladiator Expenses.py ├── 02 Data Types and Variables - Lab │ ├── 01. Concat Names.py │ ├── 02. Centuries to Minutes.py │ ├── 02. Data-Types-and-Variables-Lab.docx │ ├── 03. Special Numbers.py │ ├── 04. Convert Meters to Kilometers.py │ └── 05. Pounds to Dollars.py ├── 02 Data Types and Variables - More Exercises │ ├── 01. Biggest of 3 Numbers.py │ ├── 02. Data-Types-and-Variables-More-Exercises.docx │ ├── 02. Exchange Integers.py │ ├── 03. Prime Number Checker.py │ ├── 04. Decrypting Messages.py │ └── 05. Balanced Brackets.py ├── 03 Lists Basics - Exercise │ ├── 01. Invert Values.py │ ├── 02. Multiples List.py │ ├── 03-Lists-Basics-Exercise.docx │ ├── 03. Football Cards.py │ ├── 04. Number Beggars.py │ ├── 05. Faro Shuffle.py │ ├── 06. Survival of the Biggest.py │ ├── 07. Easter Gifts.py │ ├── 08. Seize the Fire.py │ ├── 09. Hello, France.py │ └── 10. Bread Factory.py ├── 03 Lists Basics - Lab │ ├── 01. Strange Zoo.py │ ├── 02. Courses.py │ ├── 03-Lists-Basics-Lab.docx │ ├── 03. List Statistics.py │ ├── 04. Search.py │ └── 05. Numbers Filter.py ├── 03 Lists Basics - More Exercises │ ├── 01. Zeros to Back.py │ ├── 02. Tic-Tac-Toe.py │ ├── 03-Lists-Basics-More-Exercises.docx │ ├── 03. Josephus Permutation.py │ ├── 04. Battle Ships.py │ └── 05. Hungry Hippos.py ├── 04 Functions - Exercise │ ├── 01. Smallest of Three Numbers.py │ ├── 02. Add and Subtract.py │ ├── 03. Characters in Range.py │ ├── 04. Functions-Exercise.docx │ ├── 04. Odd and Even Sum.py │ ├── 05. Palindrome Integers.py │ ├── 06. Password Validator.py │ ├── 07. Perfect Number.py │ ├── 08. Loading Bar.py │ ├── 09. Factorial Division.py │ └── 10. Array Manipulator.py ├── 04 Functions - Lab │ ├── 01. Grades.py │ ├── 02. Calculations.py │ ├── 03. Repeat String.py │ ├── 04. Functions-Lab.docx │ ├── 04. Orders.py │ └── 05. Calculate Rectangle Area.py ├── 04 Functions - More Exercises │ ├── 01. Data Types.py │ ├── 02. Center Point.py │ ├── 03. Longer Line.py │ ├── 04. Functions-More-Exercises.docx │ ├── 04. Tribonacci Sequence.py │ └── 05. Multiplication Sign.py ├── 05 Lists Advanced - Exercise │ ├── 01. Which Are In.py │ ├── 02. Big Numbers Lover.py │ ├── 03. Next Version.py │ ├── 04. Office Chairs.py │ ├── 05-Lists-Advanced-Exercise.docx │ ├── 05. Electron Distribution.py │ ├── 06. Group of 10s.py │ ├── 07. Decipher This.py │ ├── 08. Moving Target.py │ ├── 09. Heart Delivery.py │ └── 10. Inventory.py ├── 05 Lists Advanced - Lab │ ├── 01. Trains.py │ ├── 02. Todo List.py │ ├── 03. Palindrome Strings.py │ ├── 04. Even Numbers.py │ ├── 05-Lists-Advanced-Lab.docx │ └── 05. The Office.py ├── 05 Lists Advanced - More Exercises │ ├── 01. Messaging.py │ ├── 02. Car Race.py │ ├── 03. Take-Skip Rope.py │ ├── 04. Social Distribution.py │ ├── 04. Social Distribution_alt.py │ ├── 05-Lists-Advanced-More-Exercises.docx │ └── 05. Kate's Way Out.py ├── 06 Classes and Objects - Exercise │ ├── 01. Storage.py │ ├── 02. Weapon.py │ ├── 03. Catalogue.py │ ├── 04. Town.py │ ├── 05. Class.py │ ├── 06. Classes-and-Objects-Exercise.docx │ ├── 06. Inventory.py │ ├── 07. Articles.py │ ├── 08. Vehicle.py │ └── 09. Movie.py ├── 06 Classes and Objects - Lab │ ├── 01. Comment.py │ ├── 02. Party.py │ ├── 03. Email.py │ ├── 04. Zoo.py │ ├── 05. Circle.py │ └── 06. Classes-and-Objects-Lab.docx ├── 06 Classes and Objects - More Exercises │ ├── 06. Classes-and-Objects-More-Exercises.docx │ └── pong-skeleton │ │ └── main │ │ ├── ball.py │ │ ├── main.pyde │ │ ├── player.py │ │ └── sketch.properties ├── 07 Dictionaries - Exercise │ ├── 01. Count Chars in a String.py │ ├── 02. A Miner Task.py │ ├── 03. Legendary Farming.py │ ├── 04. Orders(oop).py │ ├── 04. Orders.py │ ├── 05. SoftUni Parking(oop).py │ ├── 05. SoftUni Parking.py │ ├── 06. Courses(oop).py │ ├── 06. Courses.py │ ├── 07. Dictionaries-Exercise.docx │ ├── 07. Student Academy(oop).py │ ├── 07. Student Academy.py │ ├── 08. Company Users(oop).py │ ├── 09. ForceBook.py │ └── 10. SoftUni Exam Results.py ├── 07 Dictionaries - Lab │ ├── 01. Bakery.py │ ├── 02. Stock.py │ ├── 03. Statistics.py │ ├── 04. Odd Occurrences.py │ ├── 05. Word Synonyms.py │ └── 07. Dictionaries-Lab.docx ├── 07 Dictionaries - More Exercises │ ├── 01. Ranking.py │ ├── 02. Judge.py │ ├── 03. MOBA Challenger.py │ ├── 04. Snowwhite.py │ ├── 05. Dragon Army.py │ └── 07. Dictionaries-More-Exercise.docx ├── 08 Text Processing - Exercise │ ├── 01. Valid Usernames.py │ ├── 02. Character Multiplier.py │ ├── 03. Extract File.py │ ├── 04. Caesar Cipher.py │ ├── 05. Emoticon Finder.py │ ├── 06. Replace Repeating Chars.py │ ├── 07. String Explosion.py │ ├── 08. Letters Change Numbers.py │ ├── 08. Text-Processing-Exercise.docx │ ├── 09. Rage Quit.py │ └── 10. Winning Ticket.py ├── 08 Text Processing - Lab │ ├── 01. Reverse Strings.py │ ├── 02. Repeat String.py │ ├── 03. Substring.py │ ├── 04. Text Filter.py │ ├── 05. Digits, Letters and Other.py │ └── 08. Text-Processing-Lab.docx ├── 08 Text Processing - More Exercises │ ├── 01. Extract Person Information.py │ ├── 01._Extract Person Information_Условия.docx │ ├── 02. Ascii Sumator.py │ ├── 03. Treasure Finder.py │ ├── 04. Morse Code Translator.py │ ├── 05. HTML.py │ └── 08. Text-Processing-More-Exercise.docx ├── 09 RegEx - Excercise │ ├── 01. Capture the Numbers.py │ ├── 02. Find Variable Names in Sentences.py │ ├── 03. Find Occurrences of Word in Sentence.py │ ├── 04. Extract Emails.py │ ├── 05. Furniture.py │ ├── 06. Extract Links.py │ └── 09. RegEx-Exercise.docx ├── 09 RegEx - Lab │ ├── 01. Match Full Name.py │ ├── 02. Match Phone Number.py │ ├── 03. Match Dates.py │ ├── 04. Match Numbers.py │ └── 09. RegEx-Lab.docx ├── 09 RegEx - More Exercises │ ├── 01. Race.py │ ├── 02. SoftUni Bar Income.py │ ├── 03. Star Enigma.py │ ├── 04. Nether Realms.py │ ├── 05. HTML Parser.py │ └── 09. RegEx-More-Exercise.docx ├── README.md ├── ZZ Final Exam Prep │ ├── 01. Activation Keys.py │ ├── 01. Activation Keys_Problem Description.docx │ ├── 01. Password Reset.py │ ├── 01. Password Reset_01.Password Reset.docx │ ├── 01. Secret Chat.py │ ├── 01. Secret Chat_Problem_Description.docx │ ├── 01. The Imitation Game.py │ ├── 01. The Imitation Game_Условие.docx │ ├── 01. World Tour.py │ ├── 01. World Tour_Problem Description.docx │ ├── 02. Ad Astra.py │ ├── 02. Ad Astra_Ad Astra.docx │ ├── 02. Destination Mapper.py │ ├── 02. Destination Mapper_Problem Description.docx │ ├── 02. Emoji Detector.py │ ├── 02. Emoji Detector_Problem Description.docx │ ├── 02. Fancy Barcodes.py │ ├── 02. Fancy Barcodes_Problem Description.docx │ ├── 02. Mirror Words.py │ ├── 02. Mirror Words_Problem_Description.docx │ ├── 03. Heroes of Code and Logic VII.py │ ├── 03. Heroes of Code and Logic VII_Условие.docx │ ├── 03. Heroes(non_oop).py │ ├── 03. NFS(non_oop).py │ ├── 03. Need for Speed III.py │ ├── 03. Need for Speed III_Problem_Description.docx │ ├── 03. P!rates_Problem Description.docx │ ├── 03. Pirates.py │ ├── 03. Plant Discovery.py │ ├── 03. Plant Discovery_Problem Description.docx │ ├── 03. The Pianist(non-oop).py │ ├── 03. The Pianist.py │ └── 03. The Pianist_Условие.docx ├── ZZ Final Exam │ ├── 01.py │ ├── 02.py │ └── 03.py ├── ZZ Midexam Prep │ ├── 01. Black Flag.py │ ├── 01. Bonus Scoring System.py │ ├── 01. Bonus Scoring System_01. Bonus Scoring System.docx │ ├── 01. Computer Store.py │ ├── 01. Computer Store_Problem Description.docx │ ├── 01. Counter Strike.py │ ├── 01. Counter Strike_Problem_Description.docx │ ├── 01. National Court.py │ ├── 01. National Court_01. National Court.docx │ ├── 01. SoftUni Reception.py │ ├── 01. SoftUni Reception_Description.docx │ ├── 02. Array Modifier.py │ ├── 02. Array Modifier_Description.docx │ ├── 02. MuOnline.py │ ├── 02. MuOnline_02. MuOnline.docx │ ├── 02. Shoot for the Win.py │ ├── 02. Shoot for the Win_Problem_Description.docx │ ├── 02. Shopping List.py │ ├── 02. Shopping List_02. Shopping List.docx │ ├── 02. The Lift.py │ ├── 02. The Lift_Problem_Description.docx │ ├── 02. Treasure Hunt.py │ ├── 03. Heart Delivery.py │ ├── 03. Heart Delivery_03. Heart Delivery.docx │ ├── 03. Inventory.py │ ├── 03. Inventory_03. Inventory.docx │ ├── 03. Man-O-War(OOP).py │ ├── 03. Man-O-War.py │ ├── 03. Memory Game_Problem_Description.docx │ ├── 03. Memory game.py │ ├── 03. Moving Target.py │ ├── 03. Moving Target_Problem_Description.docx │ ├── 03. Numbers.py │ ├── 03. Numbers_Description.docx │ ├── Black Flag_Black Flag.docx │ ├── Man O War_Man O War.docx │ └── Treasure Hunt_Treasure Hunt.docx └── ZZ Midexam │ ├── 01.py │ ├── 02.py │ └── 03.py └── python-oop ├── 01 - First Steps in OOP - Exercise ├── 01-First-Steps-in-OOP-Exercise.docx ├── 01. Shop.py ├── 02. Hero.py ├── 03. Emplyee.py ├── 04. Cup.py ├── 05. Flower.py ├── 06. Steam User.py ├── 07. Programmer.py └── 08. Pokemon battle │ └── project │ ├── __init__.py │ ├── pokemon.py │ ├── trainer.py │ └── trainer_test.py ├── 01 - First Steps in OOP - Lab ├── 01-First-Steps-in-OOP-Lab.docx ├── 01. Rhombus of Stars.py ├── 02. Scope Mess.py ├── 03. Class Book.py ├── 04. Car.py └── 05. Music.py ├── 02 - Classes and Objects - Exercise ├── 01. Vet.py ├── 01. Vet_Условия.docx ├── 02. Time.py ├── 03. Account.py ├── 04. Pizza Delivery.py ├── 05. Todo List │ └── project │ │ ├── __init__.py │ │ ├── section.py │ │ └── task.py ├── 06. Guild System │ └── project │ │ ├── __init__.py │ │ ├── guild.py │ │ └── player.py └── 07. Spoopify │ └── project │ ├── __init__.py │ ├── album.py │ ├── band.py │ ├── band_test.py │ ├── main.py │ └── song.py ├── 02 - Classes and Objects - Lab ├── 01. Vehicle _Условия.docx ├── 01. Vehicle.py ├── 02. Point.py ├── 03. Circle.py └── 05. Smartphone.py ├── 03 - Inheritance - Exercise ├── 01. Person │ ├── main.py │ └── project │ │ ├── __init__.py │ │ ├── child.py │ │ └── person.py ├── 02. Zoo │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── animal.py │ │ ├── bear.py │ │ ├── gorilla.py │ │ ├── lizard.py │ │ ├── mammal.py │ │ ├── reptile.py │ │ └── snake.py ├── 03-Inheritance-Exercises.docx ├── 03. Players and Monsters │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── blade_knight.py │ │ ├── dark_knight.py │ │ ├── dark_wizard.py │ │ ├── elf.py │ │ ├── hero.py │ │ ├── knight.py │ │ ├── muse_elf.py │ │ ├── soul_master.py │ │ └── wizard.py ├── 04. Need for Speed │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── car.py │ │ ├── cross_motorcycle.py │ │ ├── family_car.py │ │ ├── motorcycle.py │ │ ├── race_motorcycle.py │ │ ├── sport_car.py │ │ └── vehicle.py └── 05. Shop │ ├── main.py │ ├── main_test.py │ └── project │ ├── __init__.py │ ├── drink.py │ ├── food.py │ ├── product.py │ └── product_repository.py ├── 03 - Inheritance - Lab ├── 01. Food │ └── project │ │ ├── __init__.py │ │ ├── food.py │ │ └── fruit.py ├── 01. Food_Условия.docx ├── 02. Single Inheritance │ └── project │ │ ├── __init__.py │ │ ├── animal.py │ │ └── dog.py ├── 03. Multiple Inheritance │ └── project │ │ ├── __init__.py │ │ ├── employee.py │ │ ├── person.py │ │ └── teacher.py ├── 04. Multilevel Inheritance │ └── project │ │ ├── __init__.py │ │ ├── car.py │ │ ├── sports_car.py │ │ └── vehicle.py ├── 05. Hierarchical Inheritance │ └── project │ │ ├── __init__.py │ │ ├── animal.py │ │ ├── cat.py │ │ └── dog.py └── 06. Stack of Strings.py ├── 04 - Encapsulation - Exercise ├── 01. Wild Cat Zoo │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── animal.py │ │ ├── caretaker.py │ │ ├── cheetah.py │ │ ├── keeper.py │ │ ├── lion.py │ │ ├── tiger.py │ │ ├── vet.py │ │ ├── worker.py │ │ └── zoo.py ├── 02. Pizza Maker │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── dough.py │ │ ├── pizza.py │ │ └── topping.py ├── 03. Football Team Generator │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── player.py │ │ └── team.py ├── 04-Encapsulation-Exercise.docx └── 04. Restaurant │ ├── main.py │ ├── main_test.py │ └── project │ ├── __init__.py │ ├── beverage │ ├── __init__.py │ ├── beverage.py │ ├── coffee.py │ ├── cold_beverage.py │ ├── hot_beverage.py │ └── tea.py │ ├── food │ ├── __init__.py │ ├── cake.py │ ├── dessert.py │ ├── food.py │ ├── main_dish.py │ ├── salmon.py │ ├── soup.py │ └── starter.py │ └── product.py ├── 04 - Encapsulation - Lab ├── 01. Person.py ├── 02. Mammal.py ├── 03. Profile.py ├── 04-Encapsulation-Lab.docx ├── 04. Email Validator.py └── 05. Account.py ├── 05 - Static and Class Methods - Exercise ├── 01. Photo Album.py ├── 02. Movie World │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── customer.py │ │ ├── dvd.py │ │ └── movie_world.py ├── 03. Document Management │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── category.py │ │ ├── document.py │ │ ├── storage.py │ │ └── topic.py ├── 04. Gym │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── common.py │ │ ├── customer.py │ │ ├── equipment.py │ │ ├── exercise_plan.py │ │ ├── gym.py │ │ ├── subscription.py │ │ └── trainer.py └── 05-Static-and-Class-Methods-Exercise.docx ├── 05 - Static and Class Methods - Lab ├── 01. Calculator.py ├── 02. Shop.py ├── 03. Integer.py ├── 04. Hotel Rooms │ ├── main.py │ └── project │ │ ├── __init__.py │ │ ├── hotel.py │ │ └── room.py └── 05-Static-and-Class-Methods-Lab.docx ├── 06 - Polymorphism and Abstraction - Exercise ├── 01. Vehicle.py ├── 02. Groups.py ├── 03. Account.py ├── 04. Wild Farm │ ├── main.py │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── animals │ │ ├── __init__.py │ │ ├── animal.py │ │ ├── birds.py │ │ └── mammals.py │ │ └── food.py ├── 05. Animals │ ├── main_test.py │ └── project │ │ ├── __init__.py │ │ ├── animal.py │ │ ├── cat.py │ │ ├── dog.py │ │ ├── kitten.py │ │ └── tomcat.py └── 06-Polymorphism and Abstraction-Exercise.docx ├── 06 - Polymorphism and Abstraction - Lab ├── 02. Encryption Generator.py ├── 03. ImageArea.py ├── 03. Shapes.py ├── 04. Playing.py ├── 06-Polymorphism and Abstraction-Lab.docx └── ZZ_old │ ├── 01. Execute.py │ ├── 02. Instruments.py │ └── 06-Polymorphism-Lab.docx ├── 08 - Iterators and Generators - Exercise ├── 01. Take Skip.py ├── 02. Dictionary Iterator.py ├── 03. Countdown Iterator.py ├── 04. Sequence Repeat.py ├── 05. Take Halves.py ├── 06. Fibonacci Generator.py ├── 07. Reader.py ├── 08-Iterators-and-Generators-Exercise.docx ├── 08. Prime Numbers.py └── 09. Possible permutations.py ├── 08 - Iterators and Generators - Lab ├── 01. Custom Range.py ├── 02. Reverse Iter.py ├── 03. Vowels.py ├── 04. Squares.py ├── 05. Generator Range.py ├── 06. Reverse string.py └── 08-Iterators-and-Generators-Lab.docx ├── 09 - Decorators - Exercises ├── 01. Logged.py ├── 02. Even Parameters.py ├── 03. Bold, Italic, Underline.py ├── 04. Type Check.py ├── 05. Cache.py ├── 06. HTML Tags.py ├── 07. Execution Time.py └── 09-Decorators-Exercises.docx ├── 09 - Decorators - Lab ├── 01. Number Increment.py ├── 02. Vowel Filter.py ├── 03. Even Numbers.py ├── 04. Multiply.py └── 09-Decorators-Lab.docx ├── 10 - Testing - Exercise ├── 10-Testing-Exercise.docx └── Exercise-Resources │ ├── hero │ ├── project │ │ ├── __init__.py │ │ └── hero.py │ └── test │ │ ├── __init__.py │ │ └── test_hero.py │ ├── mammal │ ├── __init__.py │ ├── project │ │ ├── __init__.py │ │ └── mammal.py │ └── test │ │ ├── __init__.py │ │ └── test_mammal.py │ ├── student │ └── project │ │ ├── __init__.py │ │ └── student.py │ └── vehicle │ ├── project │ ├── __init__.py │ └── vehicle.py │ └── test │ ├── __init__.py │ └── test_vehicle.py ├── 10 - Testing - Lab ├── 01. Test Worker.py ├── 01. Test Worker_Условия.docx ├── CarManager │ ├── car_manager.py │ └── test_car_manager.py └── List │ └── extended_list.py ├── ZZ - Exam-Prep ├── aqua_shop.docx ├── aqua_shop │ └── project │ │ ├── __init__.py │ │ ├── aquarium │ │ ├── __init__.py │ │ ├── base_aquarium.py │ │ ├── freshwater_aquarium.py │ │ └── saltwater_aquarium.py │ │ ├── controller.py │ │ ├── decoration │ │ ├── __init__.py │ │ ├── base_decoration.py │ │ ├── decoration_repository.py │ │ ├── ornament.py │ │ └── plant.py │ │ └── fish │ │ ├── __init__.py │ │ ├── base_fish.py │ │ ├── freshwater_fish.py │ │ └── saltwater_fish.py ├── bunker_games.docx ├── bunker_games │ └── project │ │ ├── __init__.py │ │ ├── bunker.py │ │ ├── medicine │ │ ├── __init__.py │ │ ├── medicine.py │ │ ├── painkiller.py │ │ └── salve.py │ │ ├── supply │ │ ├── __init__.py │ │ ├── food_supply.py │ │ ├── supply.py │ │ └── water_supply.py │ │ └── survivor.py ├── figures_war.docx ├── figures_war │ └── project │ │ ├── __init__.py │ │ ├── battle │ │ ├── __init__.py │ │ ├── area_battle.py │ │ ├── battle.py │ │ ├── circumference_battle.py │ │ └── relative_battle.py │ │ ├── figure │ │ ├── __init__.py │ │ ├── circle.py │ │ ├── figure.py │ │ ├── rectangle.py │ │ ├── square.py │ │ └── triangle.py │ │ ├── game.py │ │ └── suitcase.py ├── hotel_everland.docx ├── hotel_everland │ └── project │ │ ├── __init__.py │ │ ├── appliances │ │ ├── __init__.py │ │ ├── appliance.py │ │ ├── fridge.py │ │ ├── laptop.py │ │ ├── stove.py │ │ └── tv.py │ │ ├── everland.py │ │ ├── people │ │ ├── __init__.py │ │ └── child.py │ │ └── rooms │ │ ├── __init__.py │ │ ├── alone_old.py │ │ ├── alone_young.py │ │ ├── old_couple.py │ │ ├── room.py │ │ ├── young_couple.py │ │ └── young_couple_with_children.py ├── players_and_monsters.docx ├── players_and_monsters │ └── project │ │ ├── __init__.py │ │ ├── battle_field.py │ │ ├── card │ │ ├── __init__.py │ │ ├── card.py │ │ ├── card_repository.py │ │ ├── magic_card.py │ │ └── trap_card.py │ │ ├── controller.py │ │ └── player │ │ ├── __init__.py │ │ ├── advanced.py │ │ ├── beginner.py │ │ ├── player.py │ │ └── player_repository.py ├── the_system.docx └── the_system │ ├── main.py │ └── project │ ├── __init__.py │ ├── hardware │ ├── __init__.py │ ├── hardware.py │ ├── heavy_hardware.py │ └── power_hardware.py │ ├── main.py │ ├── software │ ├── __init__.py │ ├── express_software.py │ ├── light_software.py │ └── software.py │ └── system.py └── ZZ - Exam ├── 01. Structure_Problem Description.docx ├── 01. Structure_Skeleton └── exam_skeleton │ └── project │ ├── __init__.py │ ├── baked_food │ ├── __init__.py │ ├── baked_food.py │ ├── bread.py │ └── cake.py │ ├── bakery.py │ ├── drink │ ├── __init__.py │ ├── drink.py │ ├── tea.py │ └── water.py │ └── table │ ├── __init__.py │ ├── inside_table.py │ ├── outside_table.py │ └── table.py ├── 03. Unit Testing_Skeleton └── project │ ├── __init__.py │ ├── pet_shop.py │ └── test │ ├── __init__.py │ └── test.py ├── project ├── __init__.py ├── baked_food │ ├── __init__.py │ ├── baked_food.py │ ├── bread.py │ └── cake.py ├── bakery.py ├── drink │ ├── __init__.py │ ├── drink.py │ ├── tea.py │ └── water.py └── table │ ├── __init__.py │ ├── inside_table.py │ ├── outside_table.py │ └── table.py └── testing └── project ├── __init__.py ├── pet_shop.py └── test ├── __init__.py └── test.py /README.md: -------------------------------------------------------------------------------- 1 | # Softuni-Python 2 | Solutions for SoftUni Problems 3 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/01-Lists-as-Stacks-and-Queues-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/01 - Lists as Stacks and Queues - Exercise/01-Lists-as-Stacks-and-Queues-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/01. Reverse Numbers with a Stack.py: -------------------------------------------------------------------------------- 1 | stack = input().split() 2 | 3 | while len(stack) > 0: 4 | print(stack.pop(), end=' ') 5 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/02. Maximum and Minimum Element.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | stack = [] 3 | 4 | for _ in range(n): 5 | command = input() 6 | if command.startswith('1 '): 7 | stack.append(int(command.split()[-1])) 8 | elif command == '2' and stack: 9 | stack.pop() 10 | elif command.startswith('3') and stack: 11 | print(max(stack)) 12 | elif command.startswith('4') and stack: 13 | print(min(stack)) 14 | result = [] 15 | while stack: 16 | result.append(stack.pop()) 17 | 18 | print(*result, sep=', ') 19 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/03. Fast Food.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | 4 | food_qty = int(input()) 5 | orders = deque(map(int, input().split())) 6 | 7 | print(max(orders)) 8 | 9 | while orders: 10 | if orders[0] > food_qty: 11 | break 12 | food_qty -= orders.popleft() 13 | 14 | if orders: 15 | print(f'Orders left: {" ".join(map(str, orders))}') 16 | else: 17 | print('Orders complete') 18 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/04. Fashion Boutique.py: -------------------------------------------------------------------------------- 1 | clothes = list(map(int, input().split())) 2 | rack_capacity = int(input()) 3 | 4 | racks = [0] 5 | 6 | while clothes: 7 | current_item = clothes.pop() 8 | if current_item + racks[-1] > rack_capacity: 9 | racks.append(current_item) 10 | else: 11 | racks[-1] += current_item 12 | 13 | print(len(racks)) 14 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/05. Truck Tour.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | 4 | n = int(input()) 5 | pumps = deque() 6 | 7 | for _ in range(n): 8 | fuel, dist = input().split() 9 | pumps.append(int(fuel)-int(dist)) 10 | 11 | for i in range(n): 12 | total_fuel = 0 13 | for pump in pumps: 14 | total_fuel += pump 15 | if total_fuel < 0: 16 | break 17 | if total_fuel >= 0: 18 | print(i) 19 | break 20 | else: 21 | pumps.append(pumps.popleft()) 22 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Exercise/06. Balanced Parentheses.py: -------------------------------------------------------------------------------- 1 | data = input() 2 | 3 | stack = [] 4 | balanced = True 5 | 6 | for c in data: 7 | if c in ['{', '(', '[']: 8 | stack.append(c) 9 | 10 | elif c in ['}', ')', ']']: 11 | if stack: 12 | c_prev = stack[-1] 13 | if ord(c) - ord(c_prev) in [1, 2]: 14 | stack.pop() 15 | else: 16 | balanced = False 17 | break 18 | 19 | if not stack and balanced: 20 | print('YES') 21 | else: 22 | print('NO') 23 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Lab/01-Lists-as-Stacks-and-Queues-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/01 - Lists as Stacks and Queues - Lab/01-Lists-as-Stacks-and-Queues-Lab.docx -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Lab/01. Reverse Strings.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | 4 | s = deque(input()) 5 | 6 | while s: 7 | print(s.pop(), end='') 8 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Lab/02. Matching Parentheses.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | 4 | brackets = deque() 5 | expr = input() 6 | 7 | for i, c in enumerate(expr): 8 | if c == '(': 9 | brackets.append(i) 10 | elif c == ')': 11 | start = brackets.pop() 12 | print(expr[start:i+1]) 13 | 14 | 15 | # s = input() 16 | 17 | # stack = [] 18 | 19 | # for c in s: 20 | # if c == '(': 21 | # stack.append('') 22 | 23 | # for i in range(len(stack)): 24 | # stack[i] += c 25 | 26 | # if c == ')': 27 | # print(stack.pop()) 28 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Lab/03. Supermarket.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | people = deque() 4 | 5 | while True: 6 | command = input() 7 | if command == 'Paid': 8 | while len(people) > 0: 9 | print(people.popleft()) 10 | elif command == 'End': 11 | break 12 | else: 13 | people.append(command) 14 | 15 | print(f'{len(people)} people remaining.') 16 | -------------------------------------------------------------------------------- /python-advanced/01 - Lists as Stacks and Queues - Lab/05. Hot Potato.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | people = deque(input().split()) 4 | n = int(input()) 5 | 6 | while len(people) > 1: 7 | people.rotate(-n) 8 | loser = people.pop() 9 | print(f'Removed {loser}') 10 | 11 | winner = people.pop() 12 | print(f'Last is {winner}') 13 | -------------------------------------------------------------------------------- /python-advanced/02 - Tuples and Sets - Exercise/01. Unique Usernames.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | 4 | def get_n_items(n: int) -> List[str]: 5 | return [input() for _ in range(n)] 6 | 7 | 8 | def fmt_output(users: List[str]) -> str: 9 | nl = '\n' 10 | return nl.join(users) 11 | 12 | 13 | def main() -> None: 14 | n = int(input()) 15 | users = get_n_items(n) 16 | unique_users = set(users) 17 | print(fmt_output(list(unique_users))) 18 | 19 | 20 | main() 21 | -------------------------------------------------------------------------------- /python-advanced/02 - Tuples and Sets - Exercise/02-Tuples-and-Sets-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/02 - Tuples and Sets - Exercise/02-Tuples-and-Sets-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/02 - Tuples and Sets - Lab/02-Tuples-and-Sets-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/02 - Tuples and Sets - Lab/02-Tuples-and-Sets-Lab.docx -------------------------------------------------------------------------------- /python-advanced/02 - Tuples and Sets - Lab/03. Record Unique Names.py: -------------------------------------------------------------------------------- 1 | def get_n_items(n: int) -> list: 2 | return [input() for _ in range(n)] 3 | 4 | 5 | def get_unique_items(items: list) -> set: 6 | return set(items) 7 | 8 | 9 | def fmt_output(items: set) -> str: 10 | nl = '\n' 11 | return nl.join([i for i in items]) 12 | 13 | 14 | def main() -> None: 15 | n = int(input()) 16 | names = get_n_items(n) 17 | unique_names = get_unique_items(names) 18 | print(fmt_output(unique_names)) 19 | 20 | 21 | main() 22 | -------------------------------------------------------------------------------- /python-advanced/03 - Multidimensional Lists - Exercise/03-Multidimensional-Lists-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/03 - Multidimensional Lists - Exercise/03-Multidimensional-Lists-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/03 - Multidimensional Lists - Exercise/05. Snake Moves.py: -------------------------------------------------------------------------------- 1 | from collections import deque 2 | 3 | n, m = [int(x) for x in input().split()] 4 | snake = deque(input()) 5 | arr = [['']*m for _ in range(n)] 6 | 7 | for i in range(n): 8 | if i % 2 == 0: 9 | for j in range(m): 10 | c = snake.popleft() 11 | arr[i][j] += c 12 | snake.append(c) 13 | else: 14 | for j in range(m-1, -1, -1): 15 | c = snake.popleft() 16 | arr[i][j] += c 17 | snake.append(c) 18 | 19 | for row in arr: 20 | print(''.join(row)) 21 | -------------------------------------------------------------------------------- /python-advanced/03 - Multidimensional Lists - Lab/03-Multidimensional-Lists-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/03 - Multidimensional Lists - Lab/03-Multidimensional-Lists-Lab.docx -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/01. Word Filter.py: -------------------------------------------------------------------------------- 1 | def even_word(word): 2 | return len(word) % 2 == 0 3 | 4 | 5 | text = input() 6 | 7 | even_words = [word for word in text.split() if even_word(word)] 8 | 9 | print('\n'.join(even_words)) 10 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/02. Words Lengths.py: -------------------------------------------------------------------------------- 1 | items = input().split(', ') 2 | 3 | d = {e: len(e) for e in items} 4 | 5 | print(', '.join(f'{k} -> {v}' for k, v in {e: len(e) for e in items}.items())) 6 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/03. Capitals.py: -------------------------------------------------------------------------------- 1 | countries = input().split(', ') 2 | capitals = input().split(', ') 3 | 4 | d = {i: j for i, j in zip(countries, capitals)} 5 | 6 | print('\n'.join(f'{i} -> {j}' for i, j in d.items())) 7 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/04-Comprehensions-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/04 - Comprehensions - Exercise/04-Comprehensions-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/04. Number Classification.py: -------------------------------------------------------------------------------- 1 | nums = list(map(int, input().split(', '))) 2 | 3 | positive = (n for n in nums if n >= 0) 4 | negative = (n for n in nums if n < 0) 5 | even = (n for n in nums if n % 2 == 0) 6 | odd = (n for n in nums if n % 2 != 0) 7 | 8 | print(f'Positive: {", ".join(str(n) for n in positive)}') 9 | print(f'Negative: {", ".join(str(n) for n in negative)}') 10 | print(f'Even: {", ".join(str(n) for n in even)}') 11 | print(f'Odd: {", ".join(str(n) for n in odd)}') 12 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/05. Diagonals.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | matrix = [[int(x) for x in input().split(', ')] for _ in range(n)] 3 | first_dia = [matrix[i][i] for i in range(n)] 4 | second_dia = [matrix[i][n-i-1] for i in range(n)] 5 | 6 | print(f'First diagonal: {", ".join(map(str, first_dia))}. Sum: {sum(first_dia)}') 7 | print(f'Second diagonal: {", ".join(map(str, second_dia))}. Sum: {sum(second_dia)}') 8 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/07. Flatten Lists.py: -------------------------------------------------------------------------------- 1 | def flatten(s): 2 | return ' '.join((j for i in reversed(s.split('|')) for j in i.split())) 3 | 4 | 5 | s = input() 6 | print(flatten(s)) 7 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Exercise/08. Heroes Inventory.py: -------------------------------------------------------------------------------- 1 | names = input().split(', ') 2 | inventory = {name: {} for name in names} 3 | 4 | for line in iter(input, 'End'): 5 | name, item, cost = line.split('-') 6 | if item not in inventory[name]: 7 | inventory[name][item] = int(cost) 8 | 9 | print('\n'.join( 10 | (f'{name} -> Items: {len(data)}, Cost: {sum(data.values())}' for name, 11 | data in inventory.items()) 12 | )) 13 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/01. ASCII Values.py: -------------------------------------------------------------------------------- 1 | chars = input().split(', ') 2 | alphabet = {c: ord(c) for c in chars} 3 | print(alphabet) 4 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/02. No Vowels.py: -------------------------------------------------------------------------------- 1 | VOWELS = {'a', 'o', 'u', 'e', 'i'} 2 | word = input() 3 | print(''.join(c for c in word if c.lower() not in VOWELS)) 4 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/03. Even Matrix.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | matrix = [[int(x) for x in input().split(', ') if int(x) % 2 == 0] 4 | for _ in range(n)] 5 | 6 | print(matrix) 7 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/04-Comprehensions-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/04 - Comprehensions - Lab/04-Comprehensions-Lab.docx -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/04. Flattening Matrix.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | matrix = [[int(x) for x in input().split(', ')] 4 | for _ in range(n)] 5 | 6 | flat = [x for row in matrix for x in row] 7 | 8 | print(flat) 9 | -------------------------------------------------------------------------------- /python-advanced/04 - Comprehensions - Lab/05. Filter Numbers.py: -------------------------------------------------------------------------------- 1 | start = int(input()) 2 | end = int(input()) 3 | 4 | filtered = [n for n in range(start, end+1) 5 | if any([n % k == 0 for k in range(2, 11)])] 6 | 7 | print(filtered) 8 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/01. Even Numbers.py: -------------------------------------------------------------------------------- 1 | def is_even(x): 2 | return x % 2 == 0 3 | 4 | 5 | nums = [int(x) for x in input().split()] 6 | print(list(filter(is_even, nums))) 7 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/02. Sort.py: -------------------------------------------------------------------------------- 1 | nums = [int(x) for x in input().split()] 2 | 3 | print(sorted(nums)) -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/03. Min Max and Sum.py: -------------------------------------------------------------------------------- 1 | nums = [int(x) for x in input().split()] 2 | 3 | print(f"The minimum number is {min(nums)}") 4 | print(f"The maximum number is {max(nums)}") 5 | print(f"The sum number is: {sum(nums)}") 6 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/04. Negative vs Positive.py: -------------------------------------------------------------------------------- 1 | def is_positive(x): 2 | return x >= 0 3 | 4 | 5 | def is_negative(x): 6 | return x < 0 7 | 8 | 9 | nums = [int(x) for x in input().split()] 10 | 11 | positive_sum = sum(filter(is_positive, nums)) 12 | negative_sum = sum(filter(is_negative, nums)) 13 | 14 | print(negative_sum) 15 | print(positive_sum) 16 | 17 | print("The negatives are stronger than the positives" if abs(negative_sum) 18 | > positive_sum else "The positives are stronger than the negatives") 19 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/05-Functions-Advanced-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/05 - Functions Advanced - Exercise/05-Functions-Advanced-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/06. Arguments Length.py: -------------------------------------------------------------------------------- 1 | def args_length(*args): 2 | return len(args) 3 | 4 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/07. Concatenate.py: -------------------------------------------------------------------------------- 1 | def concatenate(*args): 2 | return ''.join(args) -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/08. Even or Odd.py: -------------------------------------------------------------------------------- 1 | def even_odd(*args): 2 | ops = { 3 | 'even': lambda x: x % 2 == 0, 4 | 'odd': lambda x: x % 2 == 1, 5 | } 6 | op = args[-1] 7 | nums = args[0:-1] 8 | 9 | return list(filter(ops[op], nums)) 10 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/09. Function Executor.py: -------------------------------------------------------------------------------- 1 | def func_executor(*funcs_fargs): 2 | return [func(*fargs) for func, fargs in funcs_fargs] 3 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/10. Keyword Arguments Length.py: -------------------------------------------------------------------------------- 1 | def kwargs_length(**kwargs): 2 | return len(kwargs) 3 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/11. Age Assignment.py: -------------------------------------------------------------------------------- 1 | def age_assignment(*args, **kwargs): 2 | return {name: val for name in args 3 | for key, val in kwargs.items() 4 | if name[0] == key} -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/12. Recursion Palindrome.py: -------------------------------------------------------------------------------- 1 | def palindrome(word, index): 2 | r_index = len(word) - 1 - index 3 | l_chr = word[index] 4 | r_chr = word[r_index] 5 | if l_chr != r_chr: 6 | return f'{word} is not a palindrome' 7 | if index >= r_index: 8 | return f'{word} is a palindrome' 9 | return palindrome(word, index+1) 10 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Exercise/13. Recursive Power.py: -------------------------------------------------------------------------------- 1 | def recursive_power(number, power): 2 | if power == 0: 3 | return 1 4 | return number * recursive_power(number, power-1) 5 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/01. Absolute Values.py: -------------------------------------------------------------------------------- 1 | print([abs(float(x)) for x in input().split()]) 2 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/02. Rounding.py: -------------------------------------------------------------------------------- 1 | print([round(float(x)) for x in input().split()]) 2 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/03. Multiplication Function.py: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | 4 | def multiply(*args): 5 | return reduce(lambda a, b: a*b, args) 6 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/04. Operate.py: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | 4 | def operate(op, *args): 5 | ops = { 6 | "+": lambda a, b: a+b, 7 | "-": lambda a, b: a-b, 8 | "*": lambda a, b: a*b, 9 | "/": lambda a, b: a/b, 10 | } 11 | return reduce(ops[op], args) 12 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/05-Functions-Advanced-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/05 - Functions Advanced - Lab/05-Functions-Advanced-Lab.docx -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/05. Person Info.py: -------------------------------------------------------------------------------- 1 | def get_info(**kwargs): 2 | if 'name' in kwargs and 'town' in kwargs and 'age' in kwargs: 3 | return f'This is {kwargs["name"]} from {kwargs["town"]} and he is {kwargs["age"]} years old' 4 | -------------------------------------------------------------------------------- /python-advanced/05 - Functions Advanced - Lab/07. Chairs.py: -------------------------------------------------------------------------------- 1 | from itertools import combinations 2 | 3 | names = input().split(', ') 4 | n = int(input()) 5 | 6 | for combo in combinations(names, n): 7 | print(', '.join(combo)) -------------------------------------------------------------------------------- /python-advanced/06 - File Handling - Exercise/01. Even Numbers.py: -------------------------------------------------------------------------------- 1 | import string 2 | import re 3 | import os 4 | 5 | 6 | file = f'{os.path.dirname(os.path.abspath(__file__))}/text.txt' 7 | pattern = rf'[{string.punctuation}]' 8 | 9 | with open(file, 'r') as fh: 10 | content = fh.readlines() 11 | 12 | for i, line in enumerate(content): 13 | if i % 2 == 0: 14 | line = re.sub(pattern, '@', line) 15 | line = ' '.join(reversed(line.split())) 16 | print(line.strip()) 17 | -------------------------------------------------------------------------------- /python-advanced/06 - File Handling - Exercise/output.txt: -------------------------------------------------------------------------------- 1 | Line 1: -I was quick to judge him, but it wasn't his fault. (37)(4) 2 | Line 2: -Is this some kind of joke?! Is it? (24)(4) 3 | Line 3: -Quick, hide here. It is safer. (22)(4) -------------------------------------------------------------------------------- /python-advanced/06 - File Handling - Exercise/text.txt: -------------------------------------------------------------------------------- 1 | -I was quick to judge him, but it wasn't his fault. 2 | -Is this some kind of joke?! Is it? 3 | -Quick, hide here. It is safer. -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/07 - Modules - Exercise/shop/__init__.py -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/canvas.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | from helpers import clear_screen 4 | 5 | 6 | def create_window(): 7 | window = tk.Tk() 8 | window.geometry('600x600') 9 | window.title('Product Shop') 10 | 11 | return window 12 | 13 | 14 | window = create_window() 15 | -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/currenr_user.txt: -------------------------------------------------------------------------------- 1 | {"username": "1", "first_name": "1", "last_name": "2", "password": "2"} -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/img/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/07 - Modules - Exercise/shop/db/img/01.jpg -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/img/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/07 - Modules - Exercise/shop/db/img/02.jpg -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/products.txt: -------------------------------------------------------------------------------- 1 | {"id":1, "name": "prod1", "img_path":"01.jpg", "count": 1} 2 | {"id":2, "name": "prod2", "img_path":"02.jpg", "count": 2} 3 | {"id":3, "name": "prod3", "img_path":"01.jpg", "count": 2} 4 | {"id":4, "name": "prod4", "img_path":"01.jpg", "count": 3} 5 | {"id":5, "name": "prod5", "img_path":"01.jpg", "count": 2} 6 | {"id":6, "name": "prod2", "img_path":"01.jpg", "count": 2} 7 | {"id":7, "name": "prod2", "img_path":"01.jpg", "count": 2} 8 | {"id":8, "name": "prod2", "img_path":"01.jpg", "count": 2} -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/user_credentials.txt: -------------------------------------------------------------------------------- 1 | {"username": "1", "first_name": "1", "last_name": "2", "password": "2", "products": []} 2 | -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/db/users.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/07 - Modules - Exercise/shop/db/users.txt -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/helpers.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | 3 | 4 | def clear_screen(window: tk.Tk): 5 | for el in window.grid_slaves(): 6 | el.destroy() 7 | -------------------------------------------------------------------------------- /python-advanced/07 - Modules - Exercise/shop/main.py: -------------------------------------------------------------------------------- 1 | import json 2 | import tkinter as tk 3 | from typing import List, Tuple 4 | 5 | from authentification import render_main_screen 6 | from canvas import window 7 | from helpers import clear_screen 8 | 9 | if __name__ == '__main__': 10 | render_main_screen(window) 11 | window.mainloop() 12 | -------------------------------------------------------------------------------- /python-advanced/10 - Error Handling - Exercise/10-Error-Handling-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/10 - Error Handling - Exercise/10-Error-Handling-Exercise.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 April 2021/01. Problem_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 April 2021/01. Problem_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 April 2021/02. Problem_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 April 2021/02. Problem_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 April 2021/03. Problem_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 April 2021/03. Problem_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 1_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 1_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 2_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 2_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 3_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/14 February 2021/Problem 3_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 1_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 1_Problem Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 2_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 2_Problem Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 3_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/16 Dec 2020/Problem 3_Problem Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/19 August 2020/01. Taxi Express_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/19 August 2020/01. Taxi Express_Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/19 August 2020/02. Minesweeper Generator_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/19 August 2020/02. Minesweeper Generator_Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/19 August 2020/03. Numbers Search_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/19 August 2020/03. Numbers Search_Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/24 October 2020/01. Scheduling_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/24 October 2020/01. Scheduling_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/24 October 2020/02. Checkmate_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/24 October 2020/02. Checkmate_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/24 October 2020/03. List Pureness_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/24 October 2020/03. List Pureness_Условие.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/27 June 2020/01. Bombs_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/27 June 2020/01. Bombs_Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/27 June 2020/02. Snake_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/27 June 2020/02. Snake_Description.docx -------------------------------------------------------------------------------- /python-advanced/ZZ - Exam - Prep/27 June 2020/03. List Manipulator_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-advanced/ZZ - Exam - Prep/27 June 2020/03. List Manipulator_Description.docx -------------------------------------------------------------------------------- /python-basics/Exam/01. Programming Book_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/01. Programming Book_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/01_exam.py: -------------------------------------------------------------------------------- 1 | price_per_page = float(input()) 2 | price_per_cover = float(input()) 3 | printing_discount = int(input()) 4 | designer_fee = float(input()) 5 | crew_percentage = int(input()) 6 | 7 | money = price_per_page * 899 + price_per_cover * 2 8 | money = money - printing_discount * money / 100 9 | money += designer_fee 10 | money = money - crew_percentage * money / 100 11 | 12 | print(f"Avtonom should pay {money:.2f} BGN.") 13 | -------------------------------------------------------------------------------- /python-basics/Exam/02. Spaceship_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/02. Spaceship_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/02_exam.py: -------------------------------------------------------------------------------- 1 | w = float(input()) 2 | l = float(input()) 3 | h = float(input()) 4 | avg_h = float(input()) 5 | 6 | spacecraft_vol = w * l * h 7 | room_vol = 2 * 2 * (avg_h + 0.40) 8 | astronauts_count = int(spacecraft_vol / room_vol) 9 | 10 | if astronauts_count < 3: 11 | print(f'The spacecraft is too small.') 12 | elif 3 <= astronauts_count <= 10: 13 | print(f'The spacecraft holds {astronauts_count} astronauts.') 14 | else: 15 | print(f'The spacecraft is too big.') -------------------------------------------------------------------------------- /python-basics/Exam/03. Computer Room_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/03. Computer Room_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/04. Cat Food_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/04. Cat Food_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/05. Christmas Gifts_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/05. Christmas Gifts_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/05. Series.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/05. Series.docx -------------------------------------------------------------------------------- /python-basics/Exam/05_exam.py: -------------------------------------------------------------------------------- 1 | children_count = 0 2 | adults_count = 0 3 | toy_price = 5 4 | sweather_price = 15 5 | 6 | command = input() 7 | while command != 'Christmas': 8 | age = int(command) 9 | if age <= 16: 10 | children_count += 1 11 | else: 12 | adults_count += 1 13 | command = input() 14 | 15 | print(f'Number of adults: {adults_count}') 16 | print(f'Number of kids: {children_count}') 17 | print(f'Money for toys: {children_count * toy_price}') 18 | print(f'Money for sweaters: {adults_count * sweather_price}') 19 | -------------------------------------------------------------------------------- /python-basics/Exam/06. Gold Mine_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-basics/Exam/06. Gold Mine_Условие.docx -------------------------------------------------------------------------------- /python-basics/Exam/06_exam.py: -------------------------------------------------------------------------------- 1 | locations_count = int(input()) 2 | 3 | for location in range(locations_count): 4 | total_gold = 0 5 | avg_gold = 0 6 | target = float(input()) 7 | days = int(input()) 8 | for day in range(days): 9 | gold = float(input()) 10 | total_gold += gold 11 | avg_gold = total_gold / days 12 | if avg_gold >= target: 13 | print(f'Good job! Average gold per day: {avg_gold:.2f}.') 14 | else: 15 | diff = abs(target - avg_gold) 16 | print(f'You need {diff:.2f} gold.') 17 | -------------------------------------------------------------------------------- /python-basics/Exam/README.md: -------------------------------------------------------------------------------- 1 | # PythonBasicsExam_20201025 2 | October exam for Python-Basics @ SoftUni 3 | -------------------------------------------------------------------------------- /python-fundamentals/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/01-Basic-Syntax-Conditional-Statements-and-Loops-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/01-Basic-Syntax-Conditional-Statements-and-Loops-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/01. Jenny's Secret Message.py: -------------------------------------------------------------------------------- 1 | name = input() 2 | 3 | if name == 'Johnny': 4 | print('Hello, my love!') 5 | else: 6 | print(f'Hello, {name}!') -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/02. Drink Something.py: -------------------------------------------------------------------------------- 1 | age = int(input()) 2 | drink = '' 3 | 4 | if age <= 14: 5 | drink = 'toddy' 6 | elif age <= 18: 7 | drink = 'coke' 8 | elif age < 22: 9 | drink = 'beer' 10 | else: 11 | drink = 'whisky' 12 | 13 | print(f'drink {drink}') 14 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/03. Leonardo DiCaprio Oscars.py: -------------------------------------------------------------------------------- 1 | oscar = int(input()) 2 | 3 | if oscar > 88: 4 | print('Leo got one already!') 5 | elif oscar == 88: 6 | print('Leo finally won the Oscar! Leo is happy') 7 | elif oscar == 86: 8 | print('Not even for Wolf of Wall Street?!') 9 | else: 10 | print('When will you give Leo an Oscar?') -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/04. Double Char.py: -------------------------------------------------------------------------------- 1 | string = input() 2 | 3 | for chr in string: 4 | print(chr*2, end ='') -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/05. Can't Sleep Count Sheep.py: -------------------------------------------------------------------------------- 1 | bound = int(input()) 2 | 3 | for i in range(1, bound+1): 4 | print(f'{i} sheep', end='...') -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/06. Next Happy Year.py: -------------------------------------------------------------------------------- 1 | year = int(input()) 2 | 3 | while True: 4 | year += 1 5 | if len(str(year)) == len(set(str(year))): 6 | print(year) 7 | break -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Exercise/07. Maximum Multiple.py: -------------------------------------------------------------------------------- 1 | divisor = int(input()) 2 | bound = int(input()) 3 | 4 | for num in range(bound, 0, -1): 5 | if num % divisor == 0: 6 | print(num) 7 | break -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/01-Basic-Syntax-Conditional-Statements-and-Loops-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/01-Basic-Syntax-Conditional-Statements-and-Loops-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/01. Biggest Of Three Numbers.py: -------------------------------------------------------------------------------- 1 | a = int(input()) 2 | b = int(input()) 3 | c = int(input()) 4 | 5 | print(max(a, b, c)) 6 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/02. Number Definer.py: -------------------------------------------------------------------------------- 1 | num = float(input()) 2 | 3 | if num < - 1000000: 4 | print('large negative') 5 | elif - 1000000 <= num <= -1: 6 | print('negative') 7 | elif -1 < num < 0: 8 | print('small negative') 9 | elif num == 0: 10 | print('zero') 11 | elif 0 < num < 1: 12 | print('small positive') 13 | elif 1 <= num <= 1000000: 14 | print('positive') 15 | else: 16 | print('large positive') 17 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/03. Word Reverse.py: -------------------------------------------------------------------------------- 1 | a = input() 2 | print(''.join(list(reversed(a)))) 3 | 4 | 5 | def reversed_word_func(): 6 | """ 7 | Reverses the word 8 | Input: Reads console string 9 | Output: Prints reversed string on console 10 | """ 11 | word = input() 12 | reversed_word = '' 13 | 14 | for idx in range(len(word)-1, -1, -1): 15 | reversed_word += word[idx] 16 | print(reversed_word) 17 | 18 | 19 | reversed_word_func() 20 | 21 | 22 | a = input() 23 | print(a[::-1]) 24 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/04. Number Between 1 and 100.py: -------------------------------------------------------------------------------- 1 | num = float(input()) 2 | 3 | while not 1 <= num <= 100: 4 | num = float(input()) 5 | 6 | print(f'The number {num} is between 1 and 100') 7 | 8 | 9 | num = float(input()) 10 | 11 | while num > 100 or num < 1: 12 | num = float(input()) 13 | 14 | print(f'The number {num} is between 1 and 100') 15 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - Lab/05. Patterns.py: -------------------------------------------------------------------------------- 1 | number = int(input()) 2 | for top_row in range(1, number+1): 3 | print('*'*top_row) 4 | for bottom_row in range(number-1, 0, -1): 5 | print('*'*bottom_row) -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/01-Basic-Syntax-Conditional-Statements-and-Loops-More-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/01-Basic-Syntax-Conditional-Statements-and-Loops-More-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/01. Find the Largest.py: -------------------------------------------------------------------------------- 1 | num = input() 2 | 3 | dig_list = [dig for dig in str(num) if dig.isnumeric()] 4 | dig_list.sort(reverse=True) 5 | 6 | print(''.join(dig_list)) -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/02. Find The Capitals.py: -------------------------------------------------------------------------------- 1 | str = input() 2 | capitals = [] 3 | for idx, chr in enumerate(str): 4 | if 65 <= ord(chr) <= 90: 5 | capitals.append(idx) 6 | print(capitals) -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/03. Wolf In Sheep's Clothing.py: -------------------------------------------------------------------------------- 1 | animals = input() 2 | 3 | animals_list = animals.split(sep=', ') 4 | 5 | if animals_list[-1] == 'wolf': 6 | print('Please go away and stop eating my sheep') 7 | else: 8 | for idx, animal in enumerate(animals_list): 9 | if animal == 'wolf': 10 | print( 11 | f'Oi! Sheep number {len(animals_list)-idx-1}! You are about to be eaten by a wolf!') 12 | break 13 | -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/04. Sum Of A Beach.py: -------------------------------------------------------------------------------- 1 | word = input() 2 | sum_of_beach = 0 3 | 4 | sum_of_beach += word.lower().count('sand') 5 | sum_of_beach += word.lower().count('water') 6 | sum_of_beach += word.lower().count('fish') 7 | sum_of_beach += word.lower().count('sun') 8 | 9 | print(sum_of_beach) -------------------------------------------------------------------------------- /python-fundamentals/01 Basic Syntax, Conditional Statements and Loops - More-Exercise/05. How Much Coffee Do You Need.py: -------------------------------------------------------------------------------- 1 | coffees_count = 0 2 | command = input() 3 | 4 | while not command == 'END': 5 | if command.lower() in ['coding', 'cat', 'dog', 'movie']: 6 | if command == command.lower(): 7 | coffees_count += 1 8 | elif command == command.upper(): 9 | coffees_count += 2 10 | command = input() 11 | 12 | if coffees_count > 5: 13 | print('You need extra sleep') 14 | else: 15 | print(coffees_count) 16 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/01. Integer Operations.py: -------------------------------------------------------------------------------- 1 | int_one = int(input()) 2 | int_two = int(input()) 3 | int_three = int(input()) 4 | int_four = int(input()) 5 | 6 | int_sum = int((int_one + int_two) / int_three) * int_four 7 | 8 | print(int_sum) 9 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/02. Chars to String.py: -------------------------------------------------------------------------------- 1 | chr_one = input() 2 | chr_two = input() 3 | chr_three = input() 4 | 5 | cat_chr = chr_one + chr_two + chr_three 6 | 7 | print(cat_chr) -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/02. Data-Types-and-Variables-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/02 Data Types and Variables - Exercises/02. Data-Types-and-Variables-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/03. Elevator.py: -------------------------------------------------------------------------------- 1 | from math import ceil 2 | 3 | people_count = int(input()) 4 | elevator_capacity = int(input()) 5 | 6 | courses = ceil(people_count / elevator_capacity) 7 | print(courses) 8 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/04. Sum of Chars.py: -------------------------------------------------------------------------------- 1 | chars_count = int(input()) 2 | 3 | chars_sum = 0 4 | 5 | for i in range(0, chars_count): 6 | char = input() 7 | chars_sum += ord(char) 8 | 9 | print(f'The sum equals: {chars_sum}') -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/05. Print Part of the ASCII Table.py: -------------------------------------------------------------------------------- 1 | start = int(input()) 2 | end = int(input()) 3 | 4 | for num in range(start, end + 1): 5 | print(chr(num),end=' ') 6 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/06. Triples of Latin Letters.py: -------------------------------------------------------------------------------- 1 | chars_count = int(input()) 2 | 3 | for char_one in range(97,97 + chars_count): 4 | for char_two in range(97, 97 + chars_count): 5 | for char_three in range(97, 97 + chars_count): 6 | print(f'{chr(char_one)}{chr(char_two)}{chr(char_three)}') -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/07. Water Overflow.py: -------------------------------------------------------------------------------- 1 | CAPACITY = 255 2 | 3 | fillups = int(input()) 4 | 5 | total_quantity = 0 6 | 7 | for fillup in range(fillups): 8 | quantity = int(input()) 9 | if total_quantity + quantity > CAPACITY: 10 | print('Insufficient capacity!') 11 | else: 12 | total_quantity += quantity 13 | 14 | print(total_quantity) -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Exercises/08. Party Profit.py: -------------------------------------------------------------------------------- 1 | party_size = int(input()) 2 | days = int(input()) 3 | 4 | coins = 0 5 | 6 | for day in range(1, days + 1): 7 | if day % 10 == 0: 8 | party_size -= 2 9 | if day % 15 == 0: 10 | party_size += 5 11 | coins += (50 - 2 * party_size) 12 | if day % 3 == 0: 13 | coins -= 3 * party_size 14 | if day % 5 == 0: 15 | coins += 20 * party_size 16 | if day % 3 == 0: 17 | coins -= 2 * party_size 18 | 19 | print(f'{party_size} companions received {int(coins/party_size)} coins each.') 20 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/01. Concat Names.py: -------------------------------------------------------------------------------- 1 | first_name = input() 2 | last_name = input() 3 | delimiter = input() 4 | 5 | print(f'{first_name}{delimiter}{last_name}') -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/02. Centuries to Minutes.py: -------------------------------------------------------------------------------- 1 | centuries = int(input()) 2 | 3 | years = centuries * 100 4 | days = round(years * 365.2422) 5 | hours = days * 24 6 | minutes = hours * 60 7 | 8 | print(f'{centuries} centuries = {years} years = {days} days = {hours} hours = {minutes} minutes') 9 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/02. Data-Types-and-Variables-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/02 Data Types and Variables - Lab/02. Data-Types-and-Variables-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/03. Special Numbers.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | for num in range(1, n+1): 4 | dig_list = [int(dig) for dig in str(num)] 5 | if sum(dig_list) in [5, 7, 11]: 6 | print(f'{num} -> True') 7 | else: 8 | print(f'{num} -> False') 9 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/04. Convert Meters to Kilometers.py: -------------------------------------------------------------------------------- 1 | meters = int(input()) 2 | 3 | kilometers = meters / 1000 4 | 5 | print(f'{kilometers:.2f}') -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - Lab/05. Pounds to Dollars.py: -------------------------------------------------------------------------------- 1 | RATE = 1.31 2 | 3 | gbp = int(input()) 4 | 5 | usd = gbp * RATE 6 | print(f'{usd:.3f}') -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - More Exercises/01. Biggest of 3 Numbers.py: -------------------------------------------------------------------------------- 1 | int_one = int(input()) 2 | int_two = int(input()) 3 | int_three = int(input()) 4 | 5 | print(max([int_one,int_two,int_three])) -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - More Exercises/02. Data-Types-and-Variables-More-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/02 Data Types and Variables - More Exercises/02. Data-Types-and-Variables-More-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - More Exercises/02. Exchange Integers.py: -------------------------------------------------------------------------------- 1 | a_start = int(input()) 2 | b_start = int(input()) 3 | 4 | a = b_start 5 | b = a_start 6 | 7 | print(f'Before:\na = {a_start}\nb = {b_start}\nAfter:\na = {a}\nb = {b}') 8 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - More Exercises/03. Prime Number Checker.py: -------------------------------------------------------------------------------- 1 | number = int(input()) 2 | 3 | number_is_prime = True 4 | 5 | for div in range(2, number): 6 | if number % div == 0: 7 | number_is_prime = False 8 | break 9 | 10 | print(number_is_prime) 11 | -------------------------------------------------------------------------------- /python-fundamentals/02 Data Types and Variables - More Exercises/04. Decrypting Messages.py: -------------------------------------------------------------------------------- 1 | key = int(input()) 2 | lines_count = int(input()) 3 | 4 | chars_list = [] 5 | 6 | for line in range(lines_count): 7 | char = input() 8 | chars_list.append(chr(ord(char)+key)) 9 | 10 | message = ''.join(chars_list) 11 | print(message) 12 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Exercise/01. Invert Values.py: -------------------------------------------------------------------------------- 1 | orig_list = input().split() 2 | 3 | inverted_list = [] 4 | 5 | for num in orig_list: 6 | 7 | if int(num) > 0: 8 | inverted_list.append(int('-'+ num)) 9 | 10 | elif int(num) < 0: 11 | inverted_list.append(abs(int(num))) 12 | 13 | else: 14 | inverted_list.append(int(num)) 15 | 16 | print(inverted_list) -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Exercise/02. Multiples List.py: -------------------------------------------------------------------------------- 1 | factor = int(input()) 2 | count = int(input()) 3 | 4 | multiples_list = [] 5 | 6 | for num in range(1,count+1): 7 | multiples_list.append(num*factor) 8 | 9 | print(multiples_list) 10 | 11 | # print([num*factor for num in range(1,count+1)]) -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Exercise/03-Lists-Basics-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/03 Lists Basics - Exercise/03-Lists-Basics-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Exercise/06. Survival of the Biggest.py: -------------------------------------------------------------------------------- 1 | nums_list = [int(num) for num in input().split()] 2 | n = int(input()) 3 | 4 | for _ in range(n): 5 | min_num = min(nums_list) 6 | nums_list.remove(min_num) 7 | 8 | print(nums_list) 9 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Lab/01. Strange Zoo.py: -------------------------------------------------------------------------------- 1 | tail = input() 2 | body = input() 3 | head = input() 4 | 5 | meerkat = [head,body,tail] 6 | 7 | print(meerkat) -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Lab/02. Courses.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | courses = [] 4 | 5 | for _ in range(n): 6 | courses.append(input()) 7 | 8 | print(courses) 9 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Lab/03-Lists-Basics-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/03 Lists Basics - Lab/03-Lists-Basics-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Lab/03. List Statistics.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | positives = [] 4 | negatives = [] 5 | 6 | for _ in range(n): 7 | 8 | num = int(input()) 9 | 10 | if num >= 0: 11 | positives.append(num) 12 | else: 13 | negatives.append(num) 14 | 15 | print(positives) 16 | print(negatives) 17 | print( 18 | f'Count of positives: {len(positives)}. Sum of negatives: {sum(negatives)}') 19 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - Lab/04. Search.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | word = input() 3 | 4 | all_strings = [] 5 | matched_strings = [] 6 | 7 | for _ in range(n): 8 | 9 | string = input() 10 | 11 | all_strings.append(string) 12 | 13 | if word in string: 14 | matched_strings.append(string) 15 | 16 | print(all_strings) 17 | print(matched_strings) -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - More Exercises/01. Zeros to Back.py: -------------------------------------------------------------------------------- 1 | num_list = [int(num) for num in input().split(', ')] 2 | 3 | for idx in range(len(num_list)-1, -1, -1): 4 | if num_list[idx] == 0: 5 | zero = num_list.pop(idx) 6 | num_list.append(zero) 7 | 8 | print(num_list) 9 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - More Exercises/03-Lists-Basics-More-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/03 Lists Basics - More Exercises/03-Lists-Basics-More-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - More Exercises/03. Josephus Permutation.py: -------------------------------------------------------------------------------- 1 | initial_sequence = input().split(' ') 2 | k = int(input()) 3 | 4 | result_list = [] 5 | counter = 0 6 | 7 | index = 0 8 | while len(initial_sequence) > 0: 9 | counter += 1 10 | 11 | if counter % k == 0: 12 | result_list.append(initial_sequence.pop(index)) 13 | else: 14 | index += 1 15 | 16 | if index >= len(initial_sequence): 17 | index = 0 18 | 19 | print(str(result_list).replace(' ','').replace('\'','')) 20 | -------------------------------------------------------------------------------- /python-fundamentals/03 Lists Basics - More Exercises/04. Battle Ships.py: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | 3 | field = [] 4 | attacks = [] 5 | ships_destroyed = 0 6 | 7 | for i in range(n): 8 | field.append([int(num) for num in input().split()]) 9 | 10 | for attack in input().split(): 11 | x, y = attack.split('-') 12 | x = int(x) 13 | y = int(y) 14 | 15 | if not field[x][y]: 16 | continue 17 | 18 | field[x][y] -= 1 19 | 20 | if field[x][y] == 0: 21 | ships_destroyed += 1 22 | 23 | print(ships_destroyed) 24 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/01. Smallest of Three Numbers.py: -------------------------------------------------------------------------------- 1 | def smallest_of_three(n1, n2, n3): 2 | 3 | return min([n1, n2, n3]) 4 | 5 | 6 | num1 = int(input()) 7 | num2 = int(input()) 8 | num3 = int(input()) 9 | 10 | print(smallest_of_three(num1, num2, num3)) 11 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/02. Add and Subtract.py: -------------------------------------------------------------------------------- 1 | def add(n1, n2): 2 | 3 | return n1 + n2 4 | 5 | 6 | def subtract(res, n3): 7 | 8 | return res - n3 9 | 10 | 11 | def add_and_subtract(n1, n2, n3): 12 | res = add(n1, n2) 13 | 14 | return subtract(res, n3) 15 | 16 | 17 | num1 = int(input()) 18 | num2 = int(input()) 19 | num3 = int(input()) 20 | 21 | print(add_and_subtract(num1, num2, num3)) 22 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/03. Characters in Range.py: -------------------------------------------------------------------------------- 1 | def chars_in_range(c1, c2): 2 | if ord(c1) > ord(c2): 3 | c1, c2 = c2, c1 4 | 5 | return ' '.join([chr(num) for num in range(ord(c1)+1, ord(c2))]) 6 | 7 | 8 | char1 = input() 9 | char2 = input() 10 | 11 | print(chars_in_range(char1, char2)) 12 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/04. Functions-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/04 Functions - Exercise/04. Functions-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/04. Odd and Even Sum.py: -------------------------------------------------------------------------------- 1 | def odd_and_even_sum(num): 2 | odd_list = [] 3 | even_list = [] 4 | 5 | for d in str(num): 6 | odd_list = [int(d) for d in str(num) if int(d) % 2 != 0] 7 | even_list = [int(d) for d in str(num) if int(d) % 2 == 0] 8 | 9 | return f'Odd sum = {sum(odd_list)}, Even sum = {sum(even_list)}' 10 | 11 | 12 | number = int(input()) 13 | 14 | print(odd_and_even_sum(number)) 15 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/05. Palindrome Integers.py: -------------------------------------------------------------------------------- 1 | def palindrome_chk(numlist): 2 | 3 | return [True if (num == num[::-1]) else False for num in numlist.split(', ')] 4 | 5 | 6 | num_list = input() 7 | 8 | for line in palindrome_chk(num_list): 9 | print(line) 10 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/07. Perfect Number.py: -------------------------------------------------------------------------------- 1 | def perfect_num_chk(n): 2 | 3 | perfect = True 4 | divisors = [div for div in range(1, n) if n % div == 0] 5 | 6 | if n != sum(divisors): 7 | perfect = False 8 | 9 | if not perfect: 10 | return "It's not so perfect." 11 | 12 | return 'We have a perfect number!' 13 | 14 | 15 | number = int(input()) 16 | 17 | print(perfect_num_chk(number)) 18 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/08. Loading Bar.py: -------------------------------------------------------------------------------- 1 | def loading_bar(n): 2 | 3 | bar = [] 4 | el_count = n // 10 5 | 6 | for i in range(10): 7 | if el_count: 8 | bar.append('%') 9 | el_count -= 1 10 | else: 11 | bar.append('.') 12 | 13 | if bar.count('%') == 10: 14 | return f"100% Complete!\n[{''.join(bar)}]" 15 | 16 | return f"{n}% [{''.join(bar)}]\nStill loading..." 17 | 18 | 19 | number = int(input()) 20 | 21 | print(loading_bar(number)) 22 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Exercise/09. Factorial Division.py: -------------------------------------------------------------------------------- 1 | def factorial_division(n1, n2): 2 | 3 | f1 = 1 4 | f2 = 1 5 | 6 | for i in range(1, n1+1): 7 | f1 *= i 8 | 9 | for i in range(1, n2+1): 10 | f2 *= i 11 | 12 | if f2 != 0: 13 | return f'{f1/f2:.2f}' 14 | 15 | 16 | num1 = int(input()) 17 | num2 = int(input()) 18 | 19 | print(factorial_division(num1, num2)) 20 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Lab/01. Grades.py: -------------------------------------------------------------------------------- 1 | def solve(grade): 2 | result = None 3 | 4 | if 2.00 <= grade <= 2.99: 5 | result = 'Fail' 6 | elif 3.00 <= grade <= 3.49: 7 | result = 'Poor' 8 | elif 3.50 <= grade <= 4.49: 9 | result = 'Good' 10 | elif 4.50 <= grade <= 5.49: 11 | result = 'Very Good' 12 | elif 5.50 <= grade <= 6.00: 13 | result = 'Excellent' 14 | 15 | return result 16 | 17 | 18 | grade_data = float(input()) 19 | 20 | print(solve(grade_data)) 21 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Lab/02. Calculations.py: -------------------------------------------------------------------------------- 1 | def calc(o,n1,n2): 2 | result = None 3 | 4 | if o == 'multiply': 5 | result = n1 * n2 6 | 7 | elif o == 'divide' and n2 != 0: 8 | result = n1 // n2 9 | 10 | elif o == 'add': 11 | result = n1 + n2 12 | 13 | elif o == 'subtract': 14 | result = n1 - n2 15 | 16 | return result 17 | 18 | 19 | operator = input() 20 | number_1 = int(input()) 21 | number_2 = int(input()) 22 | 23 | print(calc(operator,number_1,number_2)) -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Lab/03. Repeat String.py: -------------------------------------------------------------------------------- 1 | def str_repeat(s, r): 2 | result = '' 3 | 4 | for _ in range(r): 5 | result += s 6 | 7 | return result 8 | 9 | 10 | string = input() 11 | repeat = int(input()) 12 | 13 | print(str_repeat(string, repeat)) 14 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Lab/04. Functions-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/04 Functions - Lab/04. Functions-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - Lab/05. Calculate Rectangle Area.py: -------------------------------------------------------------------------------- 1 | def rect_calc_area(a, b): 2 | return a * b 3 | 4 | 5 | side_a = int(input()) 6 | side_b = int(input()) 7 | 8 | print(rect_calc_area(side_a, side_b)) 9 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - More Exercises/01. Data Types.py: -------------------------------------------------------------------------------- 1 | def datatype_check(typ, data): 2 | 3 | if typ == 'int': 4 | return int(data) * 2 5 | 6 | elif typ == 'real': 7 | return float(data) * 1.5 8 | 9 | elif typ == 'string': 10 | return f'${data}$' 11 | 12 | 13 | typ = input() 14 | data = input() 15 | 16 | print(datatype_check(typ, data)) -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - More Exercises/02. Center Point.py: -------------------------------------------------------------------------------- 1 | def center_point(x1, y1, x2, y2): 2 | result = () 3 | 4 | if sum([abs(x1), abs(y1)]) <= sum([abs(x2), abs(y2)]): 5 | return ((int(x1), int(y1))) 6 | 7 | return ((int(x2), int(y2))) 8 | 9 | 10 | x1 = float(input()) 11 | y1 = float(input()) 12 | x2 = float(input()) 13 | y2 = float(input()) 14 | 15 | print(center_point(x1, y1, x2, y2)) 16 | -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - More Exercises/04. Functions-More-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/04 Functions - More Exercises/04. Functions-More-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/04 Functions - More Exercises/05. Multiplication Sign.py: -------------------------------------------------------------------------------- 1 | def chk_sign(l): 2 | 3 | if all(l): 4 | 5 | negatives = [num for num in l if abs(num) != num] 6 | 7 | if len(negatives) % 2 == 1: 8 | return 'negative' 9 | 10 | return 'positive' 11 | 12 | return 'zero' 13 | 14 | 15 | nums = [int(input()) for _ in range(3)] 16 | 17 | print(chk_sign(nums)) 18 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Exercise/01. Which Are In.py: -------------------------------------------------------------------------------- 1 | def which_are_in(subs: list, string: str): 2 | 3 | return [sub for sub in subs if sub in string] 4 | 5 | 6 | subs = input().split(', ') 7 | string = input() 8 | 9 | print(which_are_in(subs, string)) 10 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Exercise/02. Big Numbers Lover.py: -------------------------------------------------------------------------------- 1 | nums = input().split() 2 | 3 | nums.sort(reverse= True) 4 | 5 | print(''.join(nums)) -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Exercise/04. Office Chairs.py: -------------------------------------------------------------------------------- 1 | rooms_count = int(input()) 2 | free_chairs = 0 3 | enough_chairs = True 4 | 5 | for room in range(1, rooms_count+1): 6 | chairs, people = input().split() 7 | chairs = chairs.count('X') 8 | people = int(people) 9 | if chairs < people: 10 | enough_chairs = False 11 | print(f"{abs(chairs-people)} more chairs needed in room {room}") 12 | 13 | free_chairs += chairs - people 14 | 15 | if enough_chairs: 16 | print(f'Game On, {free_chairs} free chairs left') 17 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Exercise/05-Lists-Advanced-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/05 Lists Advanced - Exercise/05-Lists-Advanced-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Exercise/05. Electron Distribution.py: -------------------------------------------------------------------------------- 1 | def dist_electrons(n: int): 2 | shell = [0] 3 | 4 | idx = 1 5 | while n > 0: 6 | 7 | vacancies = 2*idx**2 8 | 9 | if shell[idx-1] < vacancies: 10 | n -= 1 11 | shell[idx-1] += 1 12 | else: 13 | n -= 1 14 | shell.append(1) 15 | idx += 1 16 | 17 | return shell 18 | 19 | 20 | electrons = int(input()) 21 | 22 | print(dist_electrons(electrons)) 23 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Lab/02. Todo List.py: -------------------------------------------------------------------------------- 1 | todo_list = {} 2 | 3 | command_data = input() 4 | while command_data != 'End': 5 | priority, errand, = command_data.split('-') 6 | priority = int(priority) 7 | 8 | todo_list[priority] = errand 9 | 10 | command_data = input() 11 | 12 | todo_list_sorted = [todo_list[k] for k in sorted(todo_list)] 13 | print(todo_list_sorted) 14 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Lab/03. Palindrome Strings.py: -------------------------------------------------------------------------------- 1 | def palindromes_count(l: list, k: str): 2 | p_list = list(filter(lambda x: x == x[::-1], l)) 3 | cnt = p_list.count(keyword) 4 | 5 | return (p_list, cnt) 6 | 7 | 8 | wordlist = input().split() 9 | keyword = input() 10 | 11 | p_list, cnt = palindromes_count(wordlist, keyword) 12 | print(f'{p_list}\nFound palindrome {cnt} times') 13 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Lab/04. Even Numbers.py: -------------------------------------------------------------------------------- 1 | numslist = list(map(int, input().split(', '))) 2 | even_indices = [idx for idx, num in enumerate(numslist) if num % 2 == 0] 3 | print(even_indices) 4 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - Lab/05-Lists-Advanced-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/05 Lists Advanced - Lab/05-Lists-Advanced-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - More Exercises/01. Messaging.py: -------------------------------------------------------------------------------- 1 | nums_list = list(map(int, input().split())) 2 | string = list(input()) 3 | 4 | idx = [] 5 | for num in nums_list: 6 | sum_of_digits = 0 7 | str_num = str(num) 8 | for d in str_num: 9 | sum_of_digits += int(d) 10 | idx.append(sum_of_digits) 11 | 12 | message = [] 13 | for i in idx: 14 | if i > len(string): 15 | i -= len(string) 16 | message.append(string.pop(i)) 17 | 18 | print(f'{"".join(message)}') 19 | -------------------------------------------------------------------------------- /python-fundamentals/05 Lists Advanced - More Exercises/05-Lists-Advanced-More-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/05 Lists Advanced - More Exercises/05-Lists-Advanced-More-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Exercise/02. Weapon.py: -------------------------------------------------------------------------------- 1 | class Weapon: 2 | def __init__(self, bullets: int) -> None: 3 | self.bullets = bullets 4 | 5 | def shoot(self): 6 | if self.bullets == 0: 7 | return 'no bullets left' 8 | self.bullets -= 1 9 | return 'shooting...' 10 | 11 | def __repr__(self) -> str: 12 | return f'Remaining bullets: {self.bullets}' 13 | 14 | 15 | weapon = Weapon(5) 16 | weapon.shoot() 17 | weapon.shoot() 18 | weapon.shoot() 19 | weapon.shoot() 20 | weapon.shoot() 21 | weapon.shoot() 22 | print(weapon) 23 | -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Exercise/04. Town.py: -------------------------------------------------------------------------------- 1 | class Town: 2 | def __init__(self, name: str) -> None: 3 | self.name = name 4 | 5 | def set_latitude(self, latitude: str): 6 | self.latitude = latitude 7 | 8 | def set_longitude(self, longitude: str): 9 | self.longitude = longitude 10 | 11 | def __repr__(self) -> str: 12 | return f'Town: {self.name} | Latitude: {self.latitude} | Longitude: {self.longitude}' 13 | 14 | 15 | town = Town("Sofia") 16 | town.set_latitude("42° 41\' 51.04\" N") 17 | town.set_longitude("23° 19\' 26.94\" E") 18 | print(town) 19 | -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Exercise/06. Classes-and-Objects-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/06 Classes and Objects - Exercise/06. Classes-and-Objects-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Lab/01. Comment.py: -------------------------------------------------------------------------------- 1 | class Comment: 2 | def __init__(self, username, content, likes=0) -> None: 3 | self.username = username 4 | self.content = content 5 | self.likes = likes 6 | -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Lab/02. Party.py: -------------------------------------------------------------------------------- 1 | class Party: 2 | def __init__(self) -> None: 3 | self.people = [] 4 | 5 | def go(self, name): 6 | self.name = name 7 | self.people.append(name) 8 | 9 | def get_going(self): 10 | return f'Going: {", ".join(self.people)}' 11 | 12 | def get_count(self): 13 | return f'Total: {len(self.people)}' 14 | 15 | 16 | p = Party() 17 | 18 | while True: 19 | name = input() 20 | if name == 'End': 21 | break 22 | 23 | p.go(name) 24 | 25 | 26 | print(p.get_going()) 27 | print(p.get_count()) 28 | -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - Lab/06. Classes-and-Objects-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/06 Classes and Objects - Lab/06. Classes-and-Objects-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - More Exercises/06. Classes-and-Objects-More-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/06 Classes and Objects - More Exercises/06. Classes-and-Objects-More-Exercises.docx -------------------------------------------------------------------------------- /python-fundamentals/06 Classes and Objects - More Exercises/pong-skeleton/main/sketch.properties: -------------------------------------------------------------------------------- 1 | mode=Python 2 | mode.id=jycessing.mode.PythonMode 3 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Exercise/01. Count Chars in a String.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | 4 | string = input() 5 | chars = defaultdict(int) 6 | 7 | for c in list(string): 8 | if not c.isspace(): 9 | chars[c] += 1 10 | 11 | for k, v in chars.items(): 12 | print(f'{k} -> {v}') 13 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Exercise/02. A Miner Task.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | 4 | resources = defaultdict(int) 5 | 6 | while True: 7 | token = input() 8 | if token == 'stop': 9 | break 10 | resource = token 11 | quantity = int(input()) 12 | resources[resource] += quantity 13 | 14 | for r, v in resources.items(): 15 | print(f'{r} -> {v}') 16 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Exercise/07. Dictionaries-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/07 Dictionaries - Exercise/07. Dictionaries-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/01. Bakery.py: -------------------------------------------------------------------------------- 1 | tokens = input().split(' ') 2 | bakery = {tokens[i]: int(tokens[i+1]) for i in range(0, len(tokens), 2)} 3 | print(bakery) 4 | 5 | # for i in range(0, len(tokens), 2): 6 | # bakery[tokens[i]] = int(tokens[i+1]) 7 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/02. Stock.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | tokens = input().split(' ') 4 | stock = defaultdict(int) 5 | 6 | for i in range(0, len(tokens), 2): 7 | stock[tokens[i]] += int(tokens[i+1]) 8 | 9 | products_needed = input().split(' ') 10 | 11 | for product in products_needed: 12 | if product not in stock.keys(): 13 | print(f"Sorry, we don't have {product}") 14 | else: 15 | print(f"We have {stock[product]} of {product} left") 16 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/03. Statistics.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | stock = defaultdict(int) 4 | 5 | while True: 6 | tokens = input() 7 | if tokens == 'statistics': 8 | break 9 | k, v = tokens.split(':')[0], int(tokens.split(':')[1]) 10 | stock[k] += v 11 | 12 | print('Products in stock:') 13 | for product in stock: 14 | print(f'- {product}: {stock[product]}') 15 | print(f'Total Products: {len(stock)}') 16 | print(f'Total Quantity: {sum(stock.values())}') 17 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/04. Odd Occurrences.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | d = defaultdict(int) 4 | tokens = input().split() 5 | for e in tokens: 6 | d[e.lower()] += 1 7 | 8 | odds = [e for e in d if d[e] % 2 != 0] 9 | print(' '.join(odds)) 10 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/05. Word Synonyms.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | synonyms = defaultdict(list) 4 | 5 | n = int(input()) 6 | for _ in range(n): 7 | word = input() 8 | synonym = input() 9 | synonyms[word].append(synonym) 10 | 11 | for word in synonyms: 12 | print(f'{word} - {", ".join(synonyms[word])}') 13 | -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - Lab/07. Dictionaries-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/07 Dictionaries - Lab/07. Dictionaries-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/07 Dictionaries - More Exercises/07. Dictionaries-More-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/07 Dictionaries - More Exercises/07. Dictionaries-More-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/01. Valid Usernames.py: -------------------------------------------------------------------------------- 1 | def validate(s: str): 2 | if not (3 <= len(s) <= 16): 3 | return False 4 | for c in s: 5 | if not (c.isalnum() or c in ['-', '_']): 6 | return False 7 | return True 8 | 9 | 10 | data = input().split(', ') 11 | 12 | for name in filter(validate, data): 13 | print(name) 14 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/02. Character Multiplier.py: -------------------------------------------------------------------------------- 1 | def compare_strings(data: list) -> tuple: 2 | s1 = data[0] 3 | s2 = data[1] 4 | if len(s1) == min(len(s1), len(s2)): 5 | return s1, s2 6 | return s2, s1 7 | 8 | 9 | def multiply_char(strings: tuple) -> int: 10 | s, l = strings 11 | total = 0 12 | for i in range(len(l)): 13 | if i < len(s): 14 | total += ord(s[i])*ord(l[i]) 15 | else: 16 | total += ord(l[i]) 17 | return total 18 | 19 | 20 | data = input().split() 21 | 22 | print(multiply_char(compare_strings(data))) 23 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/03. Extract File.py: -------------------------------------------------------------------------------- 1 | filepath = input().split('\\') 2 | filename, file_ext = filepath[-1].split('.') 3 | 4 | print(f'File name: {filename}') 5 | print(f'File extension: {file_ext}') -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/04. Caesar Cipher.py: -------------------------------------------------------------------------------- 1 | def caesar(text: str): 2 | result = '' 3 | for c in text: 4 | result += chr(ord(c)+3) 5 | return result 6 | 7 | text = input() 8 | print(caesar(text)) 9 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/05. Emoticon Finder.py: -------------------------------------------------------------------------------- 1 | text = input() 2 | emoticons = [] 3 | for i, c in enumerate(text): 4 | if c == ':': 5 | emoticons.append(text[i:i+2]) 6 | 7 | print('\n'.join(emoticons)) -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/06. Replace Repeating Chars.py: -------------------------------------------------------------------------------- 1 | s = input() 2 | result = '' 3 | for i in range(len(s)): 4 | if (i+1 == len(s)) or (s[i] != s[i+1]): 5 | result += s[i] 6 | print(result) 7 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/08. Letters Change Numbers.py: -------------------------------------------------------------------------------- 1 | letter_map = {chr(97+i): i+1 for i in range(26)} 2 | data = input().split() 3 | 4 | result = 0 5 | for word in data: 6 | let1 = word[0] 7 | let2 = word[-1] 8 | num = int(word[1:-1]) 9 | if let1.isupper(): 10 | num /= letter_map[let1.lower()] 11 | else: 12 | num *= letter_map[let1] 13 | if let2.isupper(): 14 | num -= letter_map[let2.lower()] 15 | else: 16 | num += letter_map[let2] 17 | result += num 18 | 19 | print(f'{result:.2f}') 20 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/08. Text-Processing-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/08 Text Processing - Exercise/08. Text-Processing-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Exercise/09. Rage Quit.py: -------------------------------------------------------------------------------- 1 | data = input() 2 | 3 | i = 0 4 | rage = '' 5 | result = '' 6 | while i < len(data): 7 | if data[i].isdigit(): 8 | num = data[i] 9 | if i+1 < len(data) and data[i+1].isdigit(): 10 | num += data[i+1] 11 | i += 1 12 | cnt = int(num) 13 | current_rage = rage*cnt 14 | result += current_rage 15 | rage = '' 16 | else: 17 | rage += data[i].upper() 18 | i += 1 19 | 20 | print(f'Unique symbols used: {len(set(result))}') 21 | print(result) 22 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Lab/01. Reverse Strings.py: -------------------------------------------------------------------------------- 1 | while True: 2 | string = input() 3 | if string == 'end': 4 | break 5 | print(f'{string} = {string[::-1]}') 6 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Lab/02. Repeat String.py: -------------------------------------------------------------------------------- 1 | def repeat_by_len(l: list): 2 | result = '' 3 | for i in l: 4 | result += i * len(i) 5 | return result 6 | 7 | 8 | strings = input().split() 9 | 10 | print(repeat_by_len(strings)) 11 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Lab/03. Substring.py: -------------------------------------------------------------------------------- 1 | def substring_replace(substring: str, string: str): 2 | while substring in string: 3 | string = string.replace(substring, '') 4 | return string 5 | 6 | 7 | substring = input() 8 | string = input() 9 | 10 | print(substring_replace(substring, string)) 11 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Lab/04. Text Filter.py: -------------------------------------------------------------------------------- 1 | def hide_words(banned_words: list, text: str): 2 | for word in banned_words: 3 | while word in text: 4 | text = text.replace(word, '*'*len(word)) 5 | return text 6 | 7 | 8 | banned_words = input().split(', ') 9 | text = input() 10 | 11 | print(hide_words(banned_words, text)) 12 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - Lab/08. Text-Processing-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/08 Text Processing - Lab/08. Text-Processing-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - More Exercises/01._Extract Person Information_Условия.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/08 Text Processing - More Exercises/01._Extract Person Information_Условия.docx -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - More Exercises/02. Ascii Sumator.py: -------------------------------------------------------------------------------- 1 | c1 = input() 2 | c2 = input() 3 | random_string = input() 4 | start = min(ord(c1), ord(c2))+1 5 | end = max(ord(c1), ord(c2)) 6 | char_range = range(start, end) 7 | 8 | total = 0 9 | 10 | for char in random_string: 11 | if ord(char) in char_range: 12 | total += ord(char) 13 | 14 | print(total) 15 | -------------------------------------------------------------------------------- /python-fundamentals/08 Text Processing - More Exercises/08. Text-Processing-More-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/08 Text Processing - More Exercises/08. Text-Processing-More-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/01. Capture the Numbers.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | pattern = r'\d+' 4 | numbers = [] 5 | line = input() 6 | 7 | while line: 8 | numbers.extend(re.findall(pattern, line)) 9 | line = input() 10 | 11 | print(' '.join(numbers)) -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/02. Find Variable Names in Sentences.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | pattern = r'((?<=^_)|(?<=\s_))(?P[A-Za-z0-9]+)\b' 5 | data = input() 6 | 7 | matches = [m.group() for m in re.finditer(pattern, data)] 8 | print(','.join(matches)) -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/03. Find Occurrences of Word in Sentence.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | data = input() 4 | searched = input() 5 | 6 | pattern = fr'(?i)\b{searched}\b' 7 | 8 | result = re.findall(pattern, data) 9 | print(len(result)) 10 | -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/04. Extract Emails.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | data = input() 4 | pattern = r'(^|(?<=\s))(?P[A-Za-z0-9]+)([\._-])?[A-Za-z0-9]+@(?P[A-Za-z]+)\-?[A-Za-z]+(\.[A-Za-z]+\-?[A-Za-z]+)+($|(?=\s))' 5 | 6 | result = re.finditer(pattern, data) 7 | 8 | for m in result: 9 | print(m.group()) -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/06. Extract Links.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | pattern = r'(^|(?<=\s))w{3}\.[A-Za-z0-9-]+(\.[a-z]+)+($|(?=\s))' 5 | 6 | while True: 7 | line = input() 8 | if not line: 9 | break 10 | for m in re.finditer(pattern, line): 11 | print(m.group()) 12 | -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Excercise/09. RegEx-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/09 RegEx - Excercise/09. RegEx-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Lab/01. Match Full Name.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | nameslist = input() 5 | pattern = r'(\b[A-Z][a-z]+ [A-Z][a-z]+\b)' 6 | 7 | matches = re.findall(pattern, nameslist) 8 | print(' '.join(matches)) 9 | -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Lab/02. Match Phone Number.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | data = input() 5 | pattern = r'(^|(?<=\s))(?P\+359(?P\s|\-)2(?P=sep)\d{3}(?P=sep)\d{4})((?=,)|$)' 6 | 7 | matches = [] 8 | for i in re.finditer(pattern, data): 9 | matches.append(i.group('number')) 10 | print(', '.join(matches)) 11 | -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Lab/03. Match Dates.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | pattern = r'(^|(?<=\s))(?P\d\d)(?P[\./-])(?P[A-Z][a-z]{2})(?P=sep)(?P\d{4})($|,|(?=\s))' 5 | data = input() 6 | 7 | for match in re.finditer(pattern, data): 8 | print( 9 | f'Day: {match.group("day")}, Month: {match.group("month")}, Year: {match.group("year")}') 10 | -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Lab/04. Match Numbers.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | pattern = r'(^|(?<=\s))(?P-?\d+(\.[\d]+)?)($|(?=\s))' 5 | data = input() 6 | 7 | matches = re.finditer(pattern, data) 8 | 9 | numbers = [n.group('num') for n in matches] 10 | print(*numbers) -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - Lab/09. RegEx-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/09 RegEx - Lab/09. RegEx-Lab.docx -------------------------------------------------------------------------------- /python-fundamentals/09 RegEx - More Exercises/09. RegEx-More-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/09 RegEx - More Exercises/09. RegEx-More-Exercise.docx -------------------------------------------------------------------------------- /python-fundamentals/README.md: -------------------------------------------------------------------------------- 1 | # softuni-python-fundamentals 2 | 3 | Softuni Python Fundamentals problems solutions 4 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/01. Activation Keys_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/01. Activation Keys_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/01. Password Reset_01.Password Reset.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/01. Password Reset_01.Password Reset.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/01. Secret Chat_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/01. Secret Chat_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/01. The Imitation Game_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/01. The Imitation Game_Условие.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/01. World Tour_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/01. World Tour_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Ad Astra_Ad Astra.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/02. Ad Astra_Ad Astra.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Destination Mapper.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | places = input() 5 | 6 | pattern = r'(?P/|=)(?P[A-Z][A-Za-z]{2,})(?P=sym)' 7 | valid_places = [] 8 | for m in re.finditer(pattern, places): 9 | valid_places.append(m.group('place')) 10 | travel_points = sum([len(place) for place in valid_places]) 11 | print(f'Destinations: {", ".join(valid_places)}') 12 | print(f'Travel Points: {travel_points}') 13 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Destination Mapper_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/02. Destination Mapper_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Emoji Detector_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/02. Emoji Detector_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Fancy Barcodes.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | pattern = r'(@#+)([A-Z][A-Za-z0-9]{4,}[A-Z])(@#+)' 5 | digits = r'\d' 6 | n = int(input()) 7 | 8 | 9 | for _ in range(n): 10 | s = input() 11 | m = re.fullmatch(pattern, s) 12 | if m: 13 | product_group = '00' 14 | current_digits = re.findall(digits, s) 15 | if current_digits: 16 | product_group = ''.join(current_digits) 17 | print(f'Product group: {product_group}') 18 | else: 19 | print(f"Invalid barcode") 20 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Fancy Barcodes_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/02. Fancy Barcodes_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/02. Mirror Words_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/02. Mirror Words_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/03. Heroes of Code and Logic VII_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/03. Heroes of Code and Logic VII_Условие.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/03. Need for Speed III_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/03. Need for Speed III_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/03. P!rates_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/03. P!rates_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/03. Plant Discovery_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/03. Plant Discovery_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Final Exam Prep/03. The Pianist_Условие.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Final Exam Prep/03. The Pianist_Условие.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. Black Flag.py: -------------------------------------------------------------------------------- 1 | days = int(input()) 2 | daily_loot = int(input()) 3 | expected_loot = int(input()) 4 | total_loot = 0 5 | 6 | for day in range(1, days+1): 7 | total_loot += daily_loot 8 | if day % 3 == 0: 9 | total_loot += 0.5 * daily_loot 10 | if day % 5 == 0: 11 | total_loot *= 0.7 12 | 13 | if total_loot >= expected_loot: 14 | print(f'Ahoy! {total_loot:.2f} plunder gained.') 15 | else: 16 | print( 17 | f'Collected only {total_loot * 100 / expected_loot:.2f}% of the plunder.') 18 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. Bonus Scoring System_01. Bonus Scoring System.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/01. Bonus Scoring System_01. Bonus Scoring System.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. Computer Store_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/01. Computer Store_Problem Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. Counter Strike_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/01. Counter Strike_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. National Court.py: -------------------------------------------------------------------------------- 1 | emp1_eff = int(input()) 2 | emp2_eff = int(input()) 3 | emp3_eff = int(input()) 4 | total_people_count = int(input()) 5 | 6 | people_answered_per_hour = sum([emp1_eff, emp2_eff, emp3_eff]) 7 | 8 | hour = 0 9 | while total_people_count > 0: 10 | hour += 1 11 | if hour % 4 == 0: 12 | continue 13 | total_people_count -= people_answered_per_hour 14 | 15 | print(f'Time needed: {hour}h.') 16 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. National Court_01. National Court.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/01. National Court_01. National Court.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. SoftUni Reception.py: -------------------------------------------------------------------------------- 1 | е1 = int(input()) 2 | е2 = int(input()) 3 | е3 = int(input()) 4 | students_count = int(input()) 5 | 6 | students_per_hour = sum([е1, е2, е3]) 7 | 8 | hour = 0 9 | while students_count > 0: 10 | hour += 1 11 | if hour % 4 == 0: 12 | continue 13 | students_count -= students_per_hour 14 | 15 | print(f'Time needed: {hour}h.') 16 | -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/01. SoftUni Reception_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/01. SoftUni Reception_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/02. Array Modifier_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/02. Array Modifier_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/02. MuOnline_02. MuOnline.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/02. MuOnline_02. MuOnline.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/02. Shoot for the Win_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/02. Shoot for the Win_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/02. Shopping List_02. Shopping List.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/02. Shopping List_02. Shopping List.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/02. The Lift_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/02. The Lift_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/03. Heart Delivery_03. Heart Delivery.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/03. Heart Delivery_03. Heart Delivery.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/03. Inventory_03. Inventory.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/03. Inventory_03. Inventory.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/03. Memory Game_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/03. Memory Game_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/03. Moving Target_Problem_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/03. Moving Target_Problem_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/03. Numbers_Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/03. Numbers_Description.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/Black Flag_Black Flag.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/Black Flag_Black Flag.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/Man O War_Man O War.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/Man O War_Man O War.docx -------------------------------------------------------------------------------- /python-fundamentals/ZZ Midexam Prep/Treasure Hunt_Treasure Hunt.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-fundamentals/ZZ Midexam Prep/Treasure Hunt_Treasure Hunt.docx -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/01-First-Steps-in-OOP-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/01 - First Steps in OOP - Exercise/01-First-Steps-in-OOP-Exercise.docx -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/01. Shop.py: -------------------------------------------------------------------------------- 1 | class Shop: 2 | def __init__(self, name: str, items: list) -> None: 3 | self.name = name 4 | self.items = items 5 | 6 | def get_items_count(self): 7 | return len(self.items) 8 | 9 | 10 | shop = Shop("My Shop", ["Apples", "Bananas", "Cucumbers"]) 11 | print(shop.get_items_count()) 12 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/02. Hero.py: -------------------------------------------------------------------------------- 1 | class Hero: 2 | def __init__(self, name: str, health: int) -> None: 3 | self.name = name 4 | self.health = health 5 | 6 | 7 | def defend(self, damage: int): 8 | self.health -= damage 9 | if self.health <= 0: 10 | self.health = 0 11 | return f'{self.name} was defeated' 12 | 13 | 14 | def heal(self, amount: int): 15 | self.health += amount 16 | 17 | 18 | hero = Hero("Peter", 100) 19 | print(hero.defend(50)) 20 | hero.heal(50) 21 | print(hero.defend(99)) 22 | print(hero.defend(1)) 23 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/04. Cup.py: -------------------------------------------------------------------------------- 1 | class Cup: 2 | def __init__(self, size: int, quantity: int) -> None: 3 | self.size = size 4 | self.quantity = quantity 5 | 6 | def fill(self, millimeters: int): 7 | if self.size - (self.quantity + millimeters) > 0: 8 | self.quantity += millimeters 9 | 10 | def status(self): 11 | return self.size - self.quantity 12 | 13 | 14 | cup = Cup(100, 50) 15 | print(cup.status()) 16 | cup.fill(40) 17 | cup.fill(20) 18 | print(cup.status()) 19 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/08. Pokemon battle/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/01 - First Steps in OOP - Exercise/08. Pokemon battle/project/__init__.py -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Exercise/08. Pokemon battle/project/pokemon.py: -------------------------------------------------------------------------------- 1 | class Pokemon: 2 | def __init__(self, name: str, health: int) -> None: 3 | self.name = name 4 | self.health = health 5 | 6 | def __hash__(self) -> int: 7 | return hash(self.name) 8 | 9 | def __eq__(self, o: object) -> bool: 10 | return isinstance(o, type(self)) and self.name == o.name 11 | 12 | def pokemon_details(self): 13 | return f'{self.name} with health {self.health}' 14 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/01-First-Steps-in-OOP-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/01 - First Steps in OOP - Lab/01-First-Steps-in-OOP-Lab.docx -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/01. Rhombus of Stars.py: -------------------------------------------------------------------------------- 1 | GROW = 1 2 | SHRINK = -1 3 | 4 | 5 | def print_rhombus(n: int): 6 | 7 | def print_line(i, trend: int): 8 | 9 | if i == 0: 10 | return 11 | 12 | line: str = ' ' * (n-i) + '* ' * i 13 | print(line.rstrip()) 14 | 15 | if i == n: 16 | trend = SHRINK 17 | 18 | print_line(i+trend, trend) 19 | 20 | print_line(1, GROW) 21 | 22 | 23 | print_rhombus(int(input())) 24 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/02. Scope Mess.py: -------------------------------------------------------------------------------- 1 | x = "global" 2 | 3 | def outer(): 4 | x = "local" 5 | 6 | def inner(): 7 | nonlocal x 8 | x = "nonlocal" 9 | print("inner:", x) 10 | 11 | def change_global(): 12 | global x 13 | x = "global: changed!" 14 | 15 | print("outer:", x) 16 | inner() 17 | print("outer:", x) 18 | change_global() 19 | 20 | print(x) 21 | outer() 22 | print(x) 23 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/03. Class Book.py: -------------------------------------------------------------------------------- 1 | class Book: 2 | def __init__(self, name: str, author: str, pages: int) -> None: 3 | self.name = name 4 | self.author = author 5 | self.pages = pages 6 | 7 | 8 | book = Book("My Book", "Me", 200) 9 | print(book.name) 10 | print(book.author) 11 | print(book.pages) 12 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/04. Car.py: -------------------------------------------------------------------------------- 1 | class Car: 2 | def __init__(self, name: str, model: str, engine: str) -> None: 3 | self.name = name 4 | self.model = model 5 | self.engine = engine 6 | 7 | def get_info(self): 8 | return f'This is {self.name} {self.model} with engine {self.engine}' 9 | 10 | 11 | car = Car("Kia", "Rio", "1.3L B3 I4") 12 | print(car.get_info()) 13 | -------------------------------------------------------------------------------- /python-oop/01 - First Steps in OOP - Lab/05. Music.py: -------------------------------------------------------------------------------- 1 | class Music: 2 | def __init__(self, title: str, artist: str, lyrics: str) -> None: 3 | self.title = title 4 | self.artist = artist 5 | self.lyrics = lyrics 6 | 7 | def print_info(self): 8 | return f'This is "{self.title}" from "{self.artist}"' 9 | 10 | def play(self): 11 | return self.lyrics 12 | 13 | 14 | song = Music("Title", "Artist", "Lyrics") 15 | print(song.print_info()) 16 | print(song.play()) 17 | -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/01. Vet_Условия.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/02 - Classes and Objects - Exercise/01. Vet_Условия.docx -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/05. Todo List/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/02 - Classes and Objects - Exercise/05. Todo List/project/__init__.py -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/06. Guild System/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/02 - Classes and Objects - Exercise/06. Guild System/project/__init__.py -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/07. Spoopify/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/02 - Classes and Objects - Exercise/07. Spoopify/project/__init__.py -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/07. Spoopify/project/main.py: -------------------------------------------------------------------------------- 1 | from song import Song 2 | from album import Album 3 | from band import Band 4 | 5 | song = Song("Running in the 90s", 3.45, False) 6 | print(song.get_info()) 7 | album = Album("Initial D", song) 8 | second_song = Song("Around the World", 2.34, False) 9 | print(album.add_song(second_song)) 10 | print(album.details()) 11 | print(album.publish()) 12 | band = Band("Manuel") 13 | print(band.add_album(album)) 14 | print(band.remove_album("Initial D")) 15 | print(band.details()) 16 | -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Exercise/07. Spoopify/project/song.py: -------------------------------------------------------------------------------- 1 | class Song: 2 | def __init__(self, name: str, length: float, single: bool) -> None: 3 | self.name = name 4 | self.length = length 5 | self.single = single 6 | 7 | def __eq__(self, o: object) -> bool: 8 | return isinstance(o, type(self)) and o.name == self.name 9 | 10 | def __hash__(self) -> int: 11 | return hash(self.name) 12 | 13 | def get_info(self) -> str: 14 | return f'{self.name} - {self.length}' 15 | -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Lab/01. Vehicle _Условия.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/02 - Classes and Objects - Lab/01. Vehicle _Условия.docx -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Lab/01. Vehicle.py: -------------------------------------------------------------------------------- 1 | class Vehicle: 2 | def __init__(self, mileage: int, max_speed: int = 150) -> None: 3 | self.mileage = mileage 4 | self.max_speed = max_speed 5 | self.gadgets = [] 6 | 7 | 8 | car = Vehicle(20) 9 | print(car.max_speed) 10 | print(car.mileage) 11 | print(car.gadgets) 12 | car.gadgets.append('Hudly Wireless') 13 | print(car.gadgets) 14 | -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Lab/02. Point.py: -------------------------------------------------------------------------------- 1 | class Point: 2 | def __init__(self, x: int, y: int) -> None: 3 | self.x = x 4 | self.y = y 5 | 6 | def set_x(self, value: int) -> None: 7 | self.x = value 8 | 9 | def set_y(self, value: int) -> None: 10 | self.y = value 11 | 12 | def __str__(self) -> str: 13 | return f'The point has coordinates ({self.x},{self.y})' 14 | 15 | 16 | p = Point(2, 4) 17 | print(p) 18 | p.set_x(3) 19 | p.set_y(5) 20 | print(p) 21 | -------------------------------------------------------------------------------- /python-oop/02 - Classes and Objects - Lab/03. Circle.py: -------------------------------------------------------------------------------- 1 | class Circle: 2 | pi = 3.14 3 | 4 | def __init__(self, radius: int) -> None: 5 | self.radius = radius 6 | 7 | def set_radius(self, value: int) -> None: 8 | self.radius = value 9 | 10 | def get_area(self) -> float: 11 | return Circle.pi * self.radius**2 12 | 13 | def get_circumference(self) -> float: 14 | return 2 * Circle.pi * self.radius 15 | 16 | 17 | circle = Circle(10) 18 | circle.set_radius(12) 19 | print(circle.get_area()) 20 | print(circle.get_circumference()) 21 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/01. Person/main.py: -------------------------------------------------------------------------------- 1 | from project import Person 2 | from project import Child 3 | 4 | person = Person("Peter", 25) 5 | child = Child("Peter Junior", 5) 6 | print(person.name) 7 | print(person.age) 8 | print(child.__class__.__bases__[0].__name__) 9 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/01. Person/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.person import Person 2 | from project.child import Child 3 | 4 | 5 | __all__ = ['Person', 'Child'] -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/01. Person/project/child.py: -------------------------------------------------------------------------------- 1 | from project import Person 2 | 3 | 4 | class Child(Person): 5 | pass 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/01. Person/project/person.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | name: str 3 | age: int 4 | 5 | def __init__(self, name, age): 6 | self.name = name 7 | self.age = age 8 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/main.py: -------------------------------------------------------------------------------- 1 | from project.lizard import Lizard 2 | from project.mammal import Mammal 3 | 4 | mammal = Mammal("Stella") 5 | print(mammal.__class__.__bases__[0].__name__) 6 | print(mammal.name) 7 | lizard = Lizard("John") 8 | print(lizard.__class__.__bases__[0].__name__) 9 | print(lizard.name) 10 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | from project.mammal import Mammal 3 | from project.bear import Bear 4 | from project.gorilla import Gorilla 5 | from project.reptile import Reptile 6 | from project.lizard import Lizard 7 | from project.snake import Snake 8 | 9 | __all__ = ['Animal', 'Mammal', 'Reptile', 'Bear', 'Gorilla', 'Lizard', 'Snake'] 10 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/animal.py: -------------------------------------------------------------------------------- 1 | class Animal: 2 | name: str 3 | 4 | def __init__(self, name: str) -> None: 5 | self.name = name 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/bear.py: -------------------------------------------------------------------------------- 1 | from project import Mammal 2 | 3 | 4 | class Bear(Mammal): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/gorilla.py: -------------------------------------------------------------------------------- 1 | from project import Mammal 2 | 3 | 4 | class Gorilla(Mammal): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/lizard.py: -------------------------------------------------------------------------------- 1 | from project import Reptile 2 | 3 | 4 | class Lizard(Reptile): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/mammal.py: -------------------------------------------------------------------------------- 1 | from project import Animal 2 | 3 | 4 | class Mammal(Animal): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/reptile.py: -------------------------------------------------------------------------------- 1 | from project import Animal 2 | 3 | 4 | class Reptile(Animal): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/02. Zoo/project/snake.py: -------------------------------------------------------------------------------- 1 | from project import Reptile 2 | 3 | 4 | class Snake(Reptile): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03-Inheritance-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Exercise/03-Inheritance-Exercises.docx -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/main.py: -------------------------------------------------------------------------------- 1 | from project import Hero, Elf 2 | 3 | hero = Hero("H", 4) 4 | print(hero.username) 5 | print(hero.level) 6 | print(str(hero)) 7 | elf = Elf("E", 4) 8 | print(str(elf)) 9 | print(elf.__class__.__bases__[0].__name__) 10 | print(elf.username) 11 | print(elf.level) 12 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.hero import Hero 2 | from project.elf import Elf 3 | from project.wizard import Wizard 4 | from project.knight import Knight 5 | from project.muse_elf import MuseElf 6 | from project.dark_wizard import DarkWizard 7 | from project.dark_knight import DarkKnight 8 | from project.soul_master import SoulMaster 9 | from project.blade_knight import BladeKnight 10 | 11 | __all__ = ['Hero', 'Elf', 'MuseElf', 'Wizard', 'DarkWizard', 'Knight', 'DarkKnight', 'SoulMaster', 'BladeKnight'] 12 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/blade_knight.py: -------------------------------------------------------------------------------- 1 | from project import DarkKnight 2 | 3 | 4 | class BladeKnight(DarkKnight): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/dark_knight.py: -------------------------------------------------------------------------------- 1 | from project import Knight 2 | 3 | 4 | class DarkKnight(Knight): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/dark_wizard.py: -------------------------------------------------------------------------------- 1 | from project import Wizard 2 | 3 | 4 | class DarkWizard(Wizard): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/elf.py: -------------------------------------------------------------------------------- 1 | from project import Hero 2 | 3 | 4 | class Elf(Hero): 5 | pass 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/hero.py: -------------------------------------------------------------------------------- 1 | class Hero: 2 | username: str 3 | level: int 4 | 5 | def __init__(self, username, level) -> None: 6 | self.username = username 7 | self.level = level 8 | 9 | def __str__(self) -> str: 10 | return f'{self.username} of type {self.__class__.__name__} has level {self.level}' 11 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/knight.py: -------------------------------------------------------------------------------- 1 | from project.hero import Hero 2 | 3 | 4 | class Knight(Hero): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/muse_elf.py: -------------------------------------------------------------------------------- 1 | from project import Elf 2 | 3 | 4 | class MuseElf(Elf): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/soul_master.py: -------------------------------------------------------------------------------- 1 | from project.dark_wizard import DarkWizard 2 | 3 | 4 | class SoulMaster(DarkWizard): 5 | pass 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/03. Players and Monsters/project/wizard.py: -------------------------------------------------------------------------------- 1 | from project import Hero 2 | 3 | 4 | class Wizard(Hero): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/main.py: -------------------------------------------------------------------------------- 1 | from project import FamilyCar 2 | from project import Vehicle 3 | 4 | 5 | vehicle = Vehicle(50, 150) 6 | print(Vehicle.DEFAULT_FUEL_CONSUMPTION) 7 | print(vehicle.fuel) 8 | print(vehicle.horse_power) 9 | print(vehicle.fuel_consumption) 10 | vehicle.drive(100) 11 | print(vehicle.fuel) 12 | family_car = FamilyCar(150, 150) 13 | family_car.drive(50) 14 | print(family_car.fuel) 15 | family_car.drive(50) 16 | print(family_car.fuel) 17 | print(family_car.__class__.__bases__[0].__name__) 18 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.vehicle import Vehicle 2 | from project.motorcycle import Motorcycle 3 | from project.cross_motorcycle import CrossMotorcycle 4 | from project.race_motorcycle import RaceMotorcycle 5 | from project.car import Car 6 | from project.family_car import FamilyCar 7 | from project.sport_car import SportCar 8 | 9 | __all__ = ['Vehicle', 'Motorcycle', 'CrossMotorcycle', 'RaceMotorcycle', 'Car', 'FamilyCar', 'SportCar'] 10 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/car.py: -------------------------------------------------------------------------------- 1 | from project import Vehicle 2 | 3 | 4 | class Car(Vehicle): 5 | DEFAULT_FUEL_CONSUMPTION = 3 -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/cross_motorcycle.py: -------------------------------------------------------------------------------- 1 | from project import Motorcycle 2 | 3 | 4 | class CrossMotorcycle(Motorcycle): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/family_car.py: -------------------------------------------------------------------------------- 1 | from project import Car 2 | 3 | 4 | class FamilyCar(Car): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/motorcycle.py: -------------------------------------------------------------------------------- 1 | from project.vehicle import Vehicle 2 | 3 | 4 | class Motorcycle(Vehicle): 5 | pass -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/race_motorcycle.py: -------------------------------------------------------------------------------- 1 | from project import Motorcycle 2 | 3 | 4 | class RaceMotorcycle(Motorcycle): 5 | DEFAULT_FUEL_CONSUMPTION = 8 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/04. Need for Speed/project/sport_car.py: -------------------------------------------------------------------------------- 1 | from project.car import Car 2 | 3 | 4 | class SportCar(Car): 5 | DEFAULT_FUEL_CONSUMPTION = 10 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/05. Shop/main.py: -------------------------------------------------------------------------------- 1 | from project.drink import Drink 2 | from project.food import Food 3 | from project import ProductRepository 4 | 5 | 6 | pr = ProductRepository() 7 | 8 | pizza = Food('pizza') 9 | beer = Drink('beer') 10 | 11 | pizza.increase(1) 12 | beer.decrease(2) 13 | 14 | pr.add(beer) 15 | pr.add(pizza) 16 | 17 | print('-'*8) 18 | 19 | print(pr) 20 | pr.remove('pizza') 21 | 22 | print('-'*8) 23 | 24 | print(pr) 25 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/05. Shop/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.product import Product 2 | from project.drink import Drink 3 | from project.food import Food 4 | from project.product_repository import ProductRepository 5 | 6 | 7 | __all__ = ['Product', 'Drink', 'Food', 'ProductRepository'] 8 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/05. Shop/project/drink.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Product 3 | 4 | 5 | class Drink(Product): 6 | QUANTITY: ClassVar[int] = 10 7 | 8 | def __init__(self, name: str) -> None: 9 | super().__init__(name, self.__class__.QUANTITY) 10 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Exercise/05. Shop/project/food.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Product 3 | 4 | 5 | class Food(Product): 6 | QUANTITY: ClassVar[int] = 15 7 | 8 | def __init__(self, name: str) -> None: 9 | super().__init__(name, self.__class__.QUANTITY) 10 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/01. Food/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/01. Food/project/__init__.py -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/01. Food/project/food.py: -------------------------------------------------------------------------------- 1 | class Food: 2 | 3 | expiration_date: str 4 | 5 | def __init__(self, expiration_date): 6 | self.expiration_date = expiration_date 7 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/01. Food/project/fruit.py: -------------------------------------------------------------------------------- 1 | from project.food import Food 2 | 3 | 4 | class Fruit(Food): 5 | 6 | name: str 7 | 8 | def __init__(self, name, expiration_date): 9 | super().__init__(expiration_date) 10 | self.name = name 11 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/01. Food_Условия.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/01. Food_Условия.docx -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/02. Single Inheritance/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/02. Single Inheritance/project/__init__.py -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/02. Single Inheritance/project/animal.py: -------------------------------------------------------------------------------- 1 | class Animal: 2 | def eat(self): 3 | return 'eating...' 4 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/02. Single Inheritance/project/dog.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | 3 | 4 | class Dog(Animal): 5 | def bark(self): 6 | return 'barking...' 7 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/03. Multiple Inheritance/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/03. Multiple Inheritance/project/__init__.py -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/03. Multiple Inheritance/project/employee.py: -------------------------------------------------------------------------------- 1 | class Employee: 2 | def get_fired(self): 3 | return 'fired...' 4 | 5 | 6 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/03. Multiple Inheritance/project/person.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | def sleep(self): 3 | return 'sleeping...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/03. Multiple Inheritance/project/teacher.py: -------------------------------------------------------------------------------- 1 | from project.person import Person 2 | from project.employee import Employee 3 | 4 | 5 | class Teacher(Person, Employee): 6 | def teach(self): 7 | return 'teaching...' 8 | -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/04. Multilevel Inheritance/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/04. Multilevel Inheritance/project/__init__.py -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/04. Multilevel Inheritance/project/car.py: -------------------------------------------------------------------------------- 1 | from project.vehicle import Vehicle 2 | 3 | class Car(Vehicle): 4 | def drive(self): 5 | return 'driving...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/04. Multilevel Inheritance/project/sports_car.py: -------------------------------------------------------------------------------- 1 | from project.car import Car 2 | 3 | 4 | class SportsCar(Car): 5 | def race(self): 6 | return 'racing...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/04. Multilevel Inheritance/project/vehicle.py: -------------------------------------------------------------------------------- 1 | class Vehicle: 2 | def move(self): 3 | return 'moving...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/05. Hierarchical Inheritance/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/03 - Inheritance - Lab/05. Hierarchical Inheritance/project/__init__.py -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/05. Hierarchical Inheritance/project/animal.py: -------------------------------------------------------------------------------- 1 | class Animal: 2 | def eat(self): 3 | return 'eating...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/05. Hierarchical Inheritance/project/cat.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | 3 | 4 | class Cat(Animal): 5 | def meow(self): 6 | return 'meowing...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/05. Hierarchical Inheritance/project/dog.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | 3 | 4 | class Dog(Animal): 5 | def bark(self): 6 | return 'barking...' -------------------------------------------------------------------------------- /python-oop/03 - Inheritance - Lab/06. Stack of Strings.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | 4 | class Stack(list): 5 | def __init__(self) -> None: 6 | super().__init__() 7 | self.data: List[str] = [] 8 | 9 | def push(self, element: str): 10 | self.data.append(element) 11 | 12 | def pop(self): 13 | return self.data.pop() 14 | 15 | def top(self): 16 | return self.data[-1] 17 | 18 | def is_empty(self): 19 | return len(self.data) == 0 20 | 21 | def __str__(self) -> str: 22 | return f'[{", ".join(reversed(self.data))}]' 23 | 24 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | from project.worker import Worker 3 | from project.lion import Lion 4 | from project.tiger import Tiger 5 | from project.cheetah import Cheetah 6 | from project.vet import Vet 7 | from project.keeper import Keeper 8 | from project.caretaker import Caretaker 9 | from project.zoo import Zoo 10 | 11 | 12 | __all__ = ['Animal', 'Worker', 'Lion', 'Tiger', 13 | 'Cheetah', 'Vet', 'Keeper', 'Caretaker', 'Zoo'] 14 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/caretaker.py: -------------------------------------------------------------------------------- 1 | from project import Worker 2 | 3 | 4 | class Caretaker(Worker): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/cheetah.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Animal 4 | 5 | 6 | class Cheetah(Animal): 7 | _MONEY_FOR_CARE: ClassVar[int] = 60 8 | 9 | def __init__(self, name: str, gender: str, age: int) -> None: 10 | super().__init__(name, gender, age, self.__class__._MONEY_FOR_CARE) 11 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/keeper.py: -------------------------------------------------------------------------------- 1 | from project import Worker 2 | 3 | 4 | class Keeper(Worker): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/lion.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Animal 4 | 5 | 6 | class Lion(Animal): 7 | _MONEY_FOR_CARE: ClassVar[int] = 50 8 | 9 | def __init__(self, name: str, gender: str, age: int) -> None: 10 | super().__init__(name, gender, age, self.__class__._MONEY_FOR_CARE) 11 | 12 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/tiger.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Animal 4 | 5 | 6 | class Tiger(Animal): 7 | _MONEY_FOR_CARE: ClassVar[int] = 45 8 | 9 | def __init__(self, name: str, gender: str, age: int) -> None: 10 | super().__init__(name, gender, age, self.__class__._MONEY_FOR_CARE) 11 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/vet.py: -------------------------------------------------------------------------------- 1 | from project import Worker 2 | 3 | 4 | class Vet(Worker): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/01. Wild Cat Zoo/project/worker.py: -------------------------------------------------------------------------------- 1 | class Worker: 2 | name: str 3 | age: int 4 | salary: int 5 | 6 | def __init__(self, name: str, age: int, salary: int) -> None: 7 | self.name = name 8 | self.age = age 9 | self.salary = salary 10 | 11 | def __eq__(self, o: object) -> bool: 12 | return isinstance(o, type(self)) and o.name == self.name 13 | 14 | def __hash__(self) -> int: 15 | return hash(self.name) 16 | 17 | def __repr__(self) -> str: 18 | return f'Name: {self.name}, Age: {self.age}, Salary: {self.salary}' 19 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/02. Pizza Maker/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.dough import Dough 2 | from project.topping import Topping 3 | from project.pizza import Pizza 4 | 5 | 6 | __all__ = ['Dough', 'Topping', 'Pizza'] 7 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/03. Football Team Generator/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.player import Player 2 | from project.team import Team 3 | 4 | __all__ = ['Player', 'Team'] 5 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04-Encapsulation-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/04 - Encapsulation - Exercise/04-Encapsulation-Exercise.docx -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/__init__.py -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/beverage.py: -------------------------------------------------------------------------------- 1 | from project import Product 2 | 3 | 4 | class Beverage(Product): 5 | __milliliters: float 6 | 7 | def __init__(self, name: str, price: float, milliliters: float) -> None: 8 | super().__init__(name, price) 9 | self.__milliliters = milliliters 10 | 11 | @property 12 | def milliliters(self): 13 | """The milliliters property.""" 14 | return self.__milliliters 15 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/coffee.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import HotBeverage 4 | 5 | 6 | class Coffee(HotBeverage): 7 | MILLILITERS: ClassVar[int] = 50 8 | PRICE: ClassVar[float] = 3.50 9 | 10 | __caffeine: float 11 | 12 | def __init__(self, name: str, caffeine: float) -> None: 13 | super().__init__(name, self.__class__.PRICE, self.__class__.MILLILITERS) 14 | self.__caffeine = caffeine 15 | 16 | @property 17 | def caffeine(self): 18 | """The caffeine property.""" 19 | return self.__caffeine 20 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/cold_beverage.py: -------------------------------------------------------------------------------- 1 | from project import Beverage 2 | 3 | 4 | class ColdBeverage(Beverage): 5 | pass 6 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/hot_beverage.py: -------------------------------------------------------------------------------- 1 | from project import Beverage 2 | 3 | 4 | class HotBeverage(Beverage): 5 | pass 6 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/beverage/tea.py: -------------------------------------------------------------------------------- 1 | from project import HotBeverage 2 | 3 | 4 | class Tea(HotBeverage): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/__init__.py -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/cake.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Dessert 4 | 5 | 6 | class Cake(Dessert): 7 | GRAMS: ClassVar[int] = 250 8 | CALORIES: ClassVar[int] = 1000 9 | PRICE: ClassVar[int] = 5 10 | 11 | def __init__(self, name: str) -> None: 12 | super().__init__(name, self.__class__.PRICE, 13 | self.__class__.GRAMS, self.__class__.CALORIES) 14 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/dessert.py: -------------------------------------------------------------------------------- 1 | from project import Food 2 | 3 | 4 | class Dessert(Food): 5 | __calories: float 6 | 7 | def __init__(self, name: str, price: float, grams: float, calories: float) -> None: 8 | super().__init__(name, price, grams) 9 | self.__calories = calories 10 | 11 | @property 12 | def calories(self): 13 | """The calories property.""" 14 | return self.__calories 15 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/food.py: -------------------------------------------------------------------------------- 1 | from project import Product 2 | 3 | 4 | class Food(Product): 5 | __grams: float 6 | 7 | def __init__(self, name: str, price: float, grams: float) -> None: 8 | super().__init__(name, price) 9 | self.__grams = grams 10 | 11 | @property 12 | def grams(self): 13 | """The grams property.""" 14 | return self.__grams 15 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/main_dish.py: -------------------------------------------------------------------------------- 1 | from project import Food 2 | 3 | 4 | class MainDish(Food): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/salmon.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import MainDish 4 | 5 | 6 | class Salmon(MainDish): 7 | GRAMS: ClassVar[int] = 22 8 | 9 | def __init__(self, name: str, price: float) -> None: 10 | super().__init__(name, price, self.__class__.GRAMS) -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/soup.py: -------------------------------------------------------------------------------- 1 | from project import Starter 2 | 3 | 4 | class Soup(Starter): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/food/starter.py: -------------------------------------------------------------------------------- 1 | from project import Food 2 | 3 | 4 | class Starter(Food): 5 | pass -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Exercise/04. Restaurant/project/product.py: -------------------------------------------------------------------------------- 1 | class Product: 2 | __name: str 3 | __price: float 4 | 5 | def __init__(self, name: str, price: float) -> None: 6 | self.__name = name 7 | self.__price = price 8 | 9 | @property 10 | def name(self): 11 | """The name property.""" 12 | return self.__name 13 | 14 | @property 15 | def price(self): 16 | """The price property.""" 17 | return self.__price 18 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Lab/01. Person.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | __name: str 3 | __age: int 4 | 5 | def __init__(self, name: str, age: int) -> None: 6 | self.__name = name 7 | self.__age = age 8 | 9 | def get_name(self) -> str: 10 | return self.__name 11 | 12 | def get_age(self) -> int: 13 | return self.__age 14 | 15 | 16 | person = Person("George", 32) 17 | print(person.get_name()) 18 | print(person.get_age()) 19 | -------------------------------------------------------------------------------- /python-oop/04 - Encapsulation - Lab/04-Encapsulation-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/04 - Encapsulation - Lab/04-Encapsulation-Lab.docx -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/02. Movie World/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.dvd import DVD 2 | from project.customer import Customer 3 | from project.movie_world import MovieWorld 4 | 5 | 6 | __all__ = ['DVD', 'Customer', 'MovieWorld'] 7 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/03. Document Management/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.topic import Topic 2 | from project.category import Category 3 | from project.document import Document 4 | from project.storage import Storage 5 | 6 | 7 | __all__ = ['Topic', 'Category', 'Document', 'Storage'] 8 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/03. Document Management/project/category.py: -------------------------------------------------------------------------------- 1 | class Category: 2 | id: int 3 | name: str 4 | 5 | def __init__(self, id: int, name: str) -> None: 6 | self.id = id 7 | self.name = name 8 | 9 | def edit(self, new_name: str) -> None: 10 | self.name = new_name 11 | 12 | def __eq__(self, o: object) -> bool: 13 | return isinstance(o, type(self)) and self.id == o.id 14 | 15 | def __hash__(self) -> int: 16 | return hash(self.id) 17 | 18 | def __repr__(self) -> str: 19 | return f'Category {self.id}: {self.name}' 20 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/__init__.py -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/customer.py: -------------------------------------------------------------------------------- 1 | from project.common import gym_dataclass 2 | 3 | 4 | Customer = gym_dataclass({ 5 | 'name': str, 6 | 'address': str, 7 | 'email': str 8 | }, 'Customer <{self.id}> {self.name}; Address: {self.address}; Email: {self.email}') 9 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/equipment.py: -------------------------------------------------------------------------------- 1 | from project.common import gym_dataclass 2 | 3 | 4 | Equipment = gym_dataclass({ 5 | 'name': str, 6 | }, 'Equipment <{self.id}> {self.name}' 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/exercise_plan.py: -------------------------------------------------------------------------------- 1 | from project.common import gym_dataclass 2 | 3 | 4 | @classmethod 5 | def from_hours(cls, trainer_id: int, equipment_id: int, hours: int): 6 | return cls(trainer_id, equipment_id, hours*60) 7 | 8 | 9 | ExercisePlan = gym_dataclass({ 10 | 'trainer_id': int, 11 | 'equipment_id': int, 12 | 'duration': int, 13 | }, 'Plan <{self.id}> with duration {self.duration} minutes' 14 | ) 15 | 16 | ExercisePlan.from_hours = from_hours 17 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/subscription.py: -------------------------------------------------------------------------------- 1 | from project.common import gym_dataclass 2 | 3 | 4 | Subscription = gym_dataclass({ 5 | 'date': str, 6 | 'customer_id': int, 7 | 'trainer_id': int, 8 | 'exercise_id': int, 9 | }, 'Subscription <{self.id}> on {self.date}') 10 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/04. Gym/project/trainer.py: -------------------------------------------------------------------------------- 1 | from project.common import gym_dataclass 2 | 3 | 4 | Trainer = gym_dataclass({ 5 | 'name':str, 6 | }, 'Trainer <{self.id}> {self.name}') -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Exercise/05-Static-and-Class-Methods-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/05 - Static and Class Methods - Exercise/05-Static-and-Class-Methods-Exercise.docx -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Lab/04. Hotel Rooms/main.py: -------------------------------------------------------------------------------- 1 | from project.hotel import Hotel 2 | from project.room import Room 3 | 4 | hotel = Hotel.from_stars(5) 5 | 6 | first_room = Room(1, 3) 7 | second_room = Room(2, 2) 8 | third_room = Room(3, 1) 9 | 10 | hotel.add_room(first_room) 11 | hotel.add_room(second_room) 12 | hotel.add_room(third_room) 13 | 14 | hotel.take_room(1, 4) 15 | hotel.take_room(1, 2) 16 | hotel.take_room(3, 1) 17 | hotel.take_room(3, 1) 18 | 19 | print(hotel.status()) 20 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Lab/04. Hotel Rooms/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.room import Room 2 | from project.hotel import Hotel 3 | 4 | __all__ = ['Room', 'Hotel'] 5 | -------------------------------------------------------------------------------- /python-oop/05 - Static and Class Methods - Lab/05-Static-and-Class-Methods-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/05 - Static and Class Methods - Lab/05-Static-and-Class-Methods-Lab.docx -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/main.py: -------------------------------------------------------------------------------- 1 | from project.food import Fruit, Meat, Vegetable 2 | from project.animals.birds import Hen, Owl 3 | 4 | 5 | owl = Owl("Pip", 10, 10) 6 | print(owl) 7 | meat = Meat(4) 8 | print(owl.make_sound()) 9 | owl.feed(meat) 10 | veg = Vegetable(1) 11 | print(owl.feed(veg)) 12 | print(owl) 13 | hen = Hen("Harry", 10, 10) 14 | veg = Vegetable(3) 15 | fruit = Fruit(5) 16 | meat = Meat(1) 17 | print(hen) 18 | print(hen.make_sound()) 19 | hen.feed(veg) 20 | hen.feed(fruit) 21 | hen.feed(meat) 22 | print(hen) 23 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.food import Food, Fruit, Meat, Seed, Vegetable 2 | from project.animals.animal import Animal, Mammal, Bird 3 | from project.animals.birds import Owl, Hen 4 | from project.animals.mammals import Cat, Dog, Mouse, Tiger 5 | 6 | 7 | __all__ = ['Food', 'Fruit', 'Meat', 'Seed', 'Vegetable', 'Animal', 8 | 'Mammal', 'Bird', 'Owl', 'Hen', 'Mouse', 'Cat', 'Dog', 'Tiger'] 9 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/project/animals/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/project/animals/__init__.py -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/project/animals/birds.py: -------------------------------------------------------------------------------- 1 | from project import Food, Meat, Bird 2 | 3 | 4 | class Owl(Bird): 5 | _VALID_FOOD_TYPES = (Meat,) 6 | _WEIGHT_INCREASE_FACTOR = 0.25 7 | _SOUND = 'Hoot Hoot' 8 | 9 | 10 | class Hen(Bird): 11 | _VALID_FOOD_TYPES = (Food,) 12 | _WEIGHT_INCREASE_FACTOR = 0.35 13 | _SOUND = 'Cluck' 14 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/04. Wild Farm/project/food.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | 4 | class Food(ABC): 5 | quantity: int 6 | 7 | def __init__(self, quantity: int) -> None: 8 | self.quantity = quantity 9 | 10 | 11 | class Vegetable(Food): 12 | pass 13 | 14 | 15 | class Fruit(Food): 16 | pass 17 | 18 | 19 | class Meat(Food): 20 | pass 21 | 22 | 23 | class Seed(Food): 24 | pass 25 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/05. Animals/project/__init__.py: -------------------------------------------------------------------------------- 1 | from project.animal import Animal 2 | from project.dog import Dog 3 | from project.cat import Cat 4 | from project.kitten import Kitten 5 | from project.tomcat import Tomcat 6 | 7 | 8 | __all__ = ['Animal', 'Dog', 'Cat', 'Kitten', 'Tomcat'] 9 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/05. Animals/project/cat.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Animal 3 | 4 | 5 | class Cat(Animal): 6 | _SOUND: ClassVar[str] = 'Meow meow!' 7 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/05. Animals/project/dog.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Animal 3 | 4 | 5 | class Dog(Animal): 6 | _SOUND: ClassVar[str] = 'Woof!' 7 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/05. Animals/project/kitten.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Cat 3 | 4 | 5 | class Kitten(Cat): 6 | _GENDER: ClassVar[str] = 'Female' 7 | _SOUND: ClassVar[str] = 'Meow' 8 | 9 | def __init__(self, name: str, age: int) -> None: 10 | super().__init__(name, age, self.__class__._GENDER) 11 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/05. Animals/project/tomcat.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | from project import Cat 3 | 4 | 5 | class Tomcat(Cat): 6 | _GENDER: ClassVar[str] = 'Male' 7 | _SOUND: ClassVar[str] = 'Hiss' 8 | 9 | def __init__(self, name: str, age: int) -> None: 10 | super().__init__(name, age, self.__class__._GENDER) -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Exercise/06-Polymorphism and Abstraction-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/06 - Polymorphism and Abstraction - Exercise/06-Polymorphism and Abstraction-Exercise.docx -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Lab/04. Playing.py: -------------------------------------------------------------------------------- 1 | def start_playing(instrument) -> str: 2 | print(instrument.play()) 3 | return instrument.play() 4 | 5 | 6 | class Guitar: 7 | def play(self): 8 | return "Playing the guitar" 9 | 10 | 11 | guitar = Guitar() 12 | start_playing(guitar) 13 | 14 | 15 | class Children: 16 | def play(self): 17 | return "Children are playing" 18 | 19 | 20 | piano = Children() 21 | start_playing(piano) 22 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Lab/06-Polymorphism and Abstraction-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/06 - Polymorphism and Abstraction - Lab/06-Polymorphism and Abstraction-Lab.docx -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Lab/ZZ_old/01. Execute.py: -------------------------------------------------------------------------------- 1 | def execute(func, *args): 2 | return func(*args) 3 | 4 | 5 | def say_hello(name, my_name): 6 | print(f"Hello, {name}, I am {my_name}") 7 | 8 | 9 | def say_bye(name): 10 | print(f"Bye, {name}") 11 | 12 | 13 | execute(say_hello, "Peter", "George") 14 | execute(say_bye, "Peter") 15 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Lab/ZZ_old/02. Instruments.py: -------------------------------------------------------------------------------- 1 | def play_instrument(instrument) -> str: 2 | return instrument.play() 3 | 4 | 5 | # class Guitar: 6 | # def play(self): 7 | # print("playing the guitar") 8 | 9 | 10 | # guitar = Guitar() 11 | # play_instrument(guitar) 12 | 13 | 14 | # class Piano: 15 | # def play(self): 16 | # print("playing the piano") 17 | 18 | 19 | # piano = Piano() 20 | # play_instrument(piano) 21 | -------------------------------------------------------------------------------- /python-oop/06 - Polymorphism and Abstraction - Lab/ZZ_old/06-Polymorphism-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/06 - Polymorphism and Abstraction - Lab/ZZ_old/06-Polymorphism-Lab.docx -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/02. Dictionary Iterator.py: -------------------------------------------------------------------------------- 1 | class dictionary_iter: 2 | def __init__(self, d) -> None: 3 | self.data = d 4 | self.__data = iter(self.data.items()) 5 | 6 | def __iter__(self): 7 | self.__data = iter(self.data.items()) 8 | return self 9 | 10 | def __next__(self): 11 | return next(self.__data) 12 | 13 | 14 | result = dictionary_iter({1: "1", 2: "2"}) 15 | for x in result: 16 | print(x) 17 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/05. Take Halves.py: -------------------------------------------------------------------------------- 1 | def solution(): 2 | 3 | def integers(): 4 | i = 1 5 | while True: 6 | yield i 7 | i += 1 8 | 9 | def halves(): 10 | for i in integers(): 11 | yield i / 2 12 | 13 | def take(n, seq): 14 | rv = [] 15 | 16 | for _ in range(n): 17 | rv.append(next(seq)) 18 | 19 | return rv 20 | 21 | return (take, halves, integers) 22 | 23 | 24 | take = solution()[0] 25 | halves = solution()[1] 26 | print(take(5, halves())) 27 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/06. Fibonacci Generator.py: -------------------------------------------------------------------------------- 1 | def fibonacci(): 2 | a, b = 0, 1 3 | 4 | while True: 5 | yield a 6 | a, b = b, a+b 7 | 8 | generator = fibonacci() 9 | for i in range(5): 10 | print(next(generator)) 11 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/07. Reader.py: -------------------------------------------------------------------------------- 1 | def read_next(*iterables): 2 | for iterable in iterables: 3 | for item in iterable: 4 | yield item 5 | 6 | 7 | for item in read_next('string', (2,), {'d': 1, 'i': 2, 'c': 3, 't': 4}): 8 | print(item, end='') 9 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/08-Iterators-and-Generators-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/08 - Iterators and Generators - Exercise/08-Iterators-and-Generators-Exercise.docx -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/08. Prime Numbers.py: -------------------------------------------------------------------------------- 1 | from typing import Generator, List 2 | import math 3 | 4 | 5 | def is_prime(num: int) -> bool: 6 | if num in (0, 1): 7 | return False 8 | 9 | for n in range(2, int(math.sqrt(num)+1)): 10 | if num % n == 0: 11 | return False 12 | 13 | return True 14 | 15 | 16 | def get_primes(nums: List[int]) -> Generator: 17 | return (n for n in nums if is_prime(n)) 18 | 19 | 20 | print(list(get_primes([2, 4, 3, 5, 6, 9, 1, 0]))) 21 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Exercise/09. Possible permutations.py: -------------------------------------------------------------------------------- 1 | from itertools import permutations 2 | from typing import Any, Generator, List 3 | 4 | 5 | def possible_permutations(seq: List[Any]) -> Generator: 6 | return (list(p) for p in permutations(seq)) 7 | 8 | 9 | [print(n) for n in possible_permutations([1, 2, 3])] 10 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Lab/02. Reverse Iter.py: -------------------------------------------------------------------------------- 1 | class reverse_iter: 2 | iterable_: list 3 | i: int 4 | 5 | def __init__(self, iterable_) -> None: 6 | self.iterable_ = iterable_ 7 | self.i = len(self.iterable_)-1 8 | 9 | def __iter__(self) -> 'reverse_iter': 10 | return self 11 | 12 | def __next__(self): 13 | if self.i < 0: 14 | raise StopIteration() 15 | 16 | i = self.i 17 | self.i -= 1 18 | return self.iterable_[i] 19 | 20 | reversed_list = reverse_iter([1, 2, 3, 4]) 21 | for item in reversed_list: 22 | print(item) 23 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Lab/04. Squares.py: -------------------------------------------------------------------------------- 1 | from typing import Generator 2 | 3 | 4 | def squares(n: int) -> Generator: 5 | i: int = 1 6 | 7 | while i <= n: 8 | yield i**2 9 | i += 1 10 | 11 | 12 | print(list(squares(5))) 13 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Lab/05. Generator Range.py: -------------------------------------------------------------------------------- 1 | from typing import Generator 2 | 3 | 4 | def genrange(start: int, end: int) -> Generator: 5 | i: int = start 6 | 7 | while i <= end: 8 | yield i 9 | i += 1 10 | 11 | 12 | print(list(genrange(1, 10))) 13 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Lab/06. Reverse string.py: -------------------------------------------------------------------------------- 1 | from typing import Generator 2 | 3 | 4 | def reverse_text(text: str) -> Generator: 5 | i: int = len(text) - 1 6 | 7 | while i >= 0: 8 | yield text[i] 9 | i -= 1 10 | 11 | for char in reverse_text("step"): 12 | print(char, end='') 13 | -------------------------------------------------------------------------------- /python-oop/08 - Iterators and Generators - Lab/08-Iterators-and-Generators-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/08 - Iterators and Generators - Lab/08-Iterators-and-Generators-Lab.docx -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Exercises/01. Logged.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def logged(func): 5 | @wraps(func) 6 | def wrapper(*args, **kwargs): 7 | 8 | rv = func(*args, **kwargs) 9 | args_str = ', '.join([str(x) for x in args]) 10 | return f'you called {func.__name__}({args_str})\nit returned {rv}' 11 | return wrapper 12 | 13 | 14 | @logged 15 | def sum_func(a, b): 16 | return a + b 17 | 18 | 19 | print(sum_func(1, 4)) 20 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Exercises/05. Cache.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def cache(func): 5 | 6 | @wraps(func) 7 | def wrapper(n): 8 | 9 | rv = func(n) 10 | 11 | if n not in wrapper.log: 12 | wrapper.log[n] = rv 13 | 14 | return wrapper.log[n] 15 | 16 | wrapper.log = {} 17 | return wrapper 18 | 19 | 20 | @cache 21 | def fibonacci(n): 22 | if n < 2: 23 | return n 24 | else: 25 | return fibonacci(n-1) + fibonacci(n-2) 26 | 27 | 28 | fibonacci(44) 29 | print(fibonacci.log) 30 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Exercises/09-Decorators-Exercises.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/09 - Decorators - Exercises/09-Decorators-Exercises.docx -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Lab/01. Number Increment.py: -------------------------------------------------------------------------------- 1 | def number_increment(numbers): 2 | 3 | def increase(): 4 | 5 | return [n+1 for n in numbers] 6 | 7 | return increase() 8 | 9 | 10 | print(number_increment([1, 2, 3])) 11 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Lab/02. Vowel Filter.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def vowel_filter(function): 5 | @wraps(function) 6 | def wrapper(*args, **kwargs): 7 | VOWELS = 'aeiouy' 8 | rv = function(*args, **kwargs) 9 | 10 | return [x for x in rv if x.lower() in VOWELS] 11 | 12 | return wrapper 13 | 14 | 15 | @vowel_filter 16 | def get_letters(): 17 | return ["a", "b", "c", "d", "e"] 18 | 19 | 20 | print(get_letters()) 21 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Lab/03. Even Numbers.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def even_numbers(function): 5 | @wraps(function) 6 | def wrapper(numbers): 7 | 8 | rv = function(numbers) 9 | return [n for n in rv if n % 2 == 0] 10 | 11 | return wrapper 12 | 13 | 14 | @even_numbers 15 | def get_numbers(numbers): 16 | return numbers 17 | 18 | 19 | print(get_numbers([1, 2, 3, 4, 5])) 20 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Lab/04. Multiply.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def multiply(times): 5 | 6 | def decorator(function): 7 | @wraps(function) 8 | def wrapper(*args, **kwargs): 9 | 10 | rv = function(*args, **kwargs) 11 | return times * rv 12 | 13 | return wrapper 14 | 15 | return decorator 16 | 17 | 18 | @multiply(5) 19 | def add_ten(number): 20 | return number + 10 21 | 22 | 23 | print(add_ten(6)) 24 | -------------------------------------------------------------------------------- /python-oop/09 - Decorators - Lab/09-Decorators-Lab.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/09 - Decorators - Lab/09-Decorators-Lab.docx -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/10-Testing-Exercise.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/10-Testing-Exercise.docx -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/hero/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/hero/project/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/hero/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/hero/test/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/project/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/project/mammal.py: -------------------------------------------------------------------------------- 1 | class Mammal: 2 | def __init__(self, name, mammal_type, sound): 3 | self.name = name 4 | self.type = mammal_type 5 | self.sound = sound 6 | self.__kingdom = "animals" 7 | 8 | def make_sound(self): 9 | return f"{self.name} makes {self.sound}" 10 | 11 | def get_kingdom(self): 12 | return self.__kingdom 13 | 14 | def info(self): 15 | return f"{self.name} is of type {self.type}" 16 | -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/mammal/test/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/student/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/student/project/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/vehicle/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/vehicle/project/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Exercise/Exercise-Resources/vehicle/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Exercise/Exercise-Resources/vehicle/test/__init__.py -------------------------------------------------------------------------------- /python-oop/10 - Testing - Lab/01. Test Worker_Условия.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Lab/01. Test Worker_Условия.docx -------------------------------------------------------------------------------- /python-oop/10 - Testing - Lab/CarManager/test_car_manager.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/10 - Testing - Lab/CarManager/test_car_manager.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/aqua_shop.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/aquarium/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/aqua_shop/project/aquarium/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/aquarium/freshwater_aquarium.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.aquarium.base_aquarium import BaseAquarium 4 | 5 | 6 | class FreshwaterAquarium(BaseAquarium): 7 | _initial_capacity: ClassVar[int] = 50 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/aquarium/saltwater_aquarium.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.aquarium.base_aquarium import BaseAquarium 4 | 5 | 6 | class SaltwaterAquarium(BaseAquarium): 7 | _initial_capacity: ClassVar[int] = 25 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/decoration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/aqua_shop/project/decoration/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/decoration/base_decoration.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class BaseDecoration(ABC): 5 | comfort: int 6 | price: float 7 | 8 | def __init__(self) -> None: 9 | self.comfort = self._default_comfort 10 | self.price = self._default_price 11 | 12 | @property 13 | @abstractmethod 14 | def _default_comfort(self) -> int: 15 | ... 16 | 17 | @property 18 | @abstractmethod 19 | def _default_price(self) -> float: 20 | ... 21 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/decoration/ornament.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.decoration.base_decoration import BaseDecoration 4 | 5 | 6 | class Ornament(BaseDecoration): 7 | _default_comfort: ClassVar[float] = 1 8 | _default_price: ClassVar[float] = 5 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/decoration/plant.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.decoration.base_decoration import BaseDecoration 4 | 5 | 6 | class Plant(BaseDecoration): 7 | _default_comfort: ClassVar[int] = 5 8 | _default_price: ClassVar[float] = 10 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/fish/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/aqua_shop/project/fish/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/fish/freshwater_fish.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.fish.base_fish import BaseFish 4 | 5 | 6 | class FreshwaterFish(BaseFish): 7 | _default_size: ClassVar[int] = 3 8 | habitat: ClassVar[str] = 'FreshwaterAquarium' 9 | 10 | def eat(self): 11 | self.size += 3 12 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/aqua_shop/project/fish/saltwater_fish.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.fish.base_fish import BaseFish 4 | 5 | 6 | class SaltwaterFish (BaseFish): 7 | _default_size: ClassVar[int] = 5 8 | habitat: ClassVar[str] = 'SaltwaterAquarium' 9 | 10 | def eat(self): 11 | self.size += 2 12 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/bunker_games.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/bunker_games/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/medicine/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/bunker_games/project/medicine/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/medicine/painkiller.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.medicine.medicine import Medicine 4 | 5 | 6 | class Painkiller(Medicine): 7 | _default_health_increase: ClassVar[int] = 20 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/medicine/salve.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.medicine.medicine import Medicine 4 | 5 | 6 | class Salve(Medicine): 7 | _default_health_increase: ClassVar[int] = 50 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/supply/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/bunker_games/project/supply/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/supply/food_supply.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.supply.supply import Supply 4 | 5 | 6 | class FoodSupply(Supply): 7 | _default_needs_increase: ClassVar[int] = 20 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/bunker_games/project/supply/water_supply.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.supply.supply import Supply 4 | 5 | 6 | class WaterSupply(Supply): 7 | _default_needs_increase: ClassVar[int] = 40 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/figures_war.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/battle/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/figures_war/project/battle/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/battle/area_battle.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.battle.battle import Battle 4 | 5 | 6 | class AreaBattle(Battle): 7 | _attr: ClassVar[str] = 'area' 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/battle/battle.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import Optional 3 | 4 | from project import Figure 5 | 6 | 7 | class Battle(ABC): 8 | @property 9 | @abstractmethod 10 | def _attr(self) -> str: 11 | ... 12 | 13 | def battle(self, fig_1: Figure, fig_2: Figure) -> Optional[Figure]: 14 | if fig_1.has_equal_attrs(fig_2, self._attr): 15 | return None 16 | 17 | elif fig_1.has_larger_attr_than(fig_2, self._attr): 18 | return fig_1 19 | 20 | else: 21 | return fig_2 22 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/battle/circumference_battle.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.battle.battle import Battle 4 | 5 | 6 | class CircumferenceBattle(Battle): 7 | _attr: ClassVar[str] = 'circumference' 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/battle/relative_battle.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.battle.battle import Battle 4 | 5 | 6 | class RelativeBattle(Battle): 7 | _attr: ClassVar[str] = 'relativity' -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/figure/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/figures_war/project/figure/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/figure/circle.py: -------------------------------------------------------------------------------- 1 | from math import pi 2 | 3 | from project import Figure 4 | 5 | 6 | class Circle(Figure): 7 | def __init__(self, name: str, radius: float) -> None: 8 | super().__init__(name, radius) 9 | self.radius = self.attributes[0] 10 | 11 | def calculate_area(self) -> float: 12 | return pi * self.radius ** 2 13 | 14 | def calculate_circumference(self) -> float: 15 | return 2 * pi * self.radius 16 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/figure/rectangle.py: -------------------------------------------------------------------------------- 1 | from project import Figure 2 | 3 | 4 | class Rectangle(Figure): 5 | def __init__(self, name: str, side_a: float, side_b: float) -> None: 6 | super().__init__(name, side_a, side_b) 7 | self.side_a = self.attributes[0] 8 | self.side_b = self.attributes[1] 9 | 10 | def calculate_area(self) -> float: 11 | return self.side_a * self.side_b 12 | 13 | def calculate_circumference(self) -> float: 14 | return 2 * (self.side_a + self.side_b) 15 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/figures_war/project/figure/square.py: -------------------------------------------------------------------------------- 1 | from project import Figure 2 | 3 | 4 | class Square(Figure): 5 | def __init__(self, name: str, side: float) -> None: 6 | super().__init__(name, side) 7 | self.side = self.attributes[0] 8 | 9 | def calculate_area(self) -> float: 10 | return self.side ** 2 11 | 12 | def calculate_circumference(self) -> float: 13 | return 4 * self.side 14 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/hotel_everland.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/hotel_everland/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/appliance.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | 4 | class Appliance: 5 | cost: float 6 | _days_in_month: ClassVar[int] = 30 7 | 8 | def __init__(self, cost: float) -> None: 9 | self.cost = cost 10 | 11 | def get_monthly_expense(self): 12 | return self.cost * self._days_in_month 13 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/fridge.py: -------------------------------------------------------------------------------- 1 | from project.appliances.appliance import Appliance 2 | 3 | 4 | class Fridge(Appliance): 5 | _default_cost = 1.2 6 | 7 | def __init__(self) -> None: 8 | super().__init__(self._default_cost) -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/laptop.py: -------------------------------------------------------------------------------- 1 | from project.appliances.appliance import Appliance 2 | 3 | 4 | class Laptop(Appliance): 5 | _default_cost = 1.0 6 | 7 | def __init__(self) -> None: 8 | super().__init__(self._default_cost) -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/stove.py: -------------------------------------------------------------------------------- 1 | from project.appliances.appliance import Appliance 2 | 3 | 4 | class Stove(Appliance): 5 | _default_cost = 0.7 6 | 7 | def __init__(self) -> None: 8 | super().__init__(self._default_cost) -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/appliances/tv.py: -------------------------------------------------------------------------------- 1 | from project.appliances.appliance import Appliance 2 | 3 | 4 | class TV(Appliance): 5 | _default_cost = 1.5 6 | 7 | def __init__(self) -> None: 8 | super().__init__(self._default_cost) -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/people/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/hotel_everland/project/people/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/people/child.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | 4 | class Child: 5 | cost: float 6 | _days_in_month: ClassVar[int] = 30 7 | 8 | def __init__(self, food_cost: float, *toys_cost: float) -> None: 9 | self.cost = food_cost + sum(toys_cost) 10 | 11 | def get_monthly_expense(self): 12 | return self.cost * self._days_in_month 13 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/rooms/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/hotel_everland/project/rooms/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/hotel_everland/project/rooms/alone_old.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.rooms.room import Room 4 | 5 | 6 | class AloneOld(Room): 7 | _adults_count: ClassVar[int] = 1 8 | _default_room_cost: ClassVar[int] = 10 9 | 10 | def __init__(self, family_name: str, pension: float) -> None: 11 | super().__init__(family_name, pension, self._adults_count) 12 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/players_and_monsters.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/players_and_monsters/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/battle_field.py: -------------------------------------------------------------------------------- 1 | from project.player.player import Player 2 | 3 | 4 | class BattleField: 5 | @staticmethod 6 | def fight(attacker: Player, enemy: Player) -> None: 7 | if attacker.is_dead or enemy.is_dead: 8 | raise ValueError("Player is dead!") 9 | 10 | attacker.apply_bonus(), enemy.apply_bonus() 11 | 12 | attacker.attack(enemy) 13 | if enemy.is_dead: 14 | return 15 | 16 | enemy.attack(attacker) 17 | if attacker.is_dead: 18 | return 19 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/card/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/players_and_monsters/project/card/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/card/magic_card.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.card.card import Card 4 | 5 | 6 | class MagicCard(Card): 7 | _initial_damage_points: ClassVar[int] = 5 8 | _initial_health_points: ClassVar[int] = 80 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/card/trap_card.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.card.card import Card 4 | 5 | 6 | class TrapCard(Card): 7 | _initial_damage_points: ClassVar[int] = 120 8 | _initial_health_points: ClassVar[int] = 5 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/player/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/players_and_monsters/project/player/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/player/advanced.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.player.player import Player 4 | 5 | 6 | class Advanced(Player): 7 | _initial_health: ClassVar[int] = 250 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/players_and_monsters/project/player/beginner.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project.player.player import Player 4 | 5 | 6 | class Beginner(Player): 7 | _initial_health: ClassVar[int] = 50 8 | _additional_health_bonus: ClassVar[int] = 40 9 | _additional_damage_bonus: ClassVar[int] = 30 10 | 11 | def apply_bonus(self) -> None: 12 | self.health += self._additional_health_bonus 13 | for c in self.card_repository.cards: 14 | c.damage_points += self._additional_damage_bonus 15 | 16 | super().apply_bonus() 17 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/the_system.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/the_system.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/the_system/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/the_system/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/the_system/project/hardware/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/the_system/project/hardware/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam-Prep/the_system/project/software/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam-Prep/the_system/project/software/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Problem Description.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Problem Description.docx -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/baked_food.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/baked_food.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/bread.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/bread.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/cake.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/baked_food/cake.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/bakery.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/bakery.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/drink.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/drink.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/tea.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/tea.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/water.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/drink/water.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/inside_table.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/inside_table.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/outside_table.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/outside_table.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/table.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/01. Structure_Skeleton/exam_skeleton/project/table/table.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/03. Unit Testing_Skeleton/project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/03. Unit Testing_Skeleton/project/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/03. Unit Testing_Skeleton/project/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/03. Unit Testing_Skeleton/project/test/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/03. Unit Testing_Skeleton/project/test/test.py: -------------------------------------------------------------------------------- 1 | from project.pet_shop import PetShop 2 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/baked_food/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/project/baked_food/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/baked_food/bread.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import BakedFood 4 | 5 | 6 | class Bread(BakedFood): 7 | _default_portion: ClassVar[float] = 200 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/baked_food/cake.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import BakedFood 4 | 5 | 6 | class Cake(BakedFood): 7 | _default_portion: ClassVar[float] = 245 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/drink/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/project/drink/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/drink/tea.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Drink 4 | 5 | 6 | class Tea(Drink): 7 | _default_price: ClassVar[float] = 2.50 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/drink/water.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Drink 4 | 5 | 6 | class Water(Drink): 7 | _default_price: ClassVar[float] = 1.50 8 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/table/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/project/table/__init__.py -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/table/inside_table.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Table 4 | 5 | 6 | class InsideTable(Table): 7 | _valid_numbers_range: ClassVar[range] = range(1, 51) 8 | _invalid_number_message: ClassVar[str] = "Inside table's number must be between 1 and 50 inclusive!" 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/project/table/outside_table.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from project import Table 4 | 5 | 6 | class OutsideTable(Table): 7 | _valid_numbers_range: ClassVar[range] = range(51, 101) 8 | _invalid_number_message: ClassVar[str] = "Outside table's number must be between 51 and 100 inclusive!" 9 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/testing/project/__init__.py: -------------------------------------------------------------------------------- 1 | # from project. 2 | 3 | # __all__ = [''] 4 | -------------------------------------------------------------------------------- /python-oop/ZZ - Exam/testing/project/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkolew/Softuni-Python/e5a0d6b13570239a32245e8126cd3cf6abd58d3f/python-oop/ZZ - Exam/testing/project/test/__init__.py --------------------------------------------------------------------------------