onurbsofa / Truco.py

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Card Game For Learning Python Creating a Game

Description:

Using a this tutorial(https://copyassignment.com/python-oop-projects-source-code-and-example/) i will learn OOP programming and create a card game.

Tutorial Concepts:

Introduction We all know that Python is a vast language that supports many libraries for almost every work we need to do. But, we should also practice OOP concepts in Python as these are the fundamental needs of industry-level projects. We should create Python OOP projects to get our hands dirty with Python OOP concepts. Today we will explore the most famous Python projects which can be developed with Python OOP concepts. But, before that, let’s get a brief introduction to OOP concepts in Python.

What is OOP? OOP or object-oriented programming is a computer science model that revolves around the use of objects as basic entities in a program. The aim of OOP is that the data should not be accessible from outside the designated functions and also to reduce redundant or duplicate codes and provide an easy to use and simple interface for the users. OOP consists of Object, Class, Methods, and the 4 pillars of OOP.

Object: An object is used to represent a real-life entity and it can be anything like a car, person, employee, or something abstract that contains certain properties and functions. Class: Class is the blueprint through which objects are created. They define the structure and functions of the objects. The class allows the creation of multiple objects of the same type without the need to repeat code. Method: A method is a collection of lines of code that perform a specific task. This could be as simple as printing to the console or performing complex calculations. They allow the reusability of code and save time.

The 4 pillars of OOP

Abstraction:

It is a property by which we hide unnecessary details from the user. For example, if a user wants to order food, he/she should only have to give order details and get the order acknowledgment, they do not need to know about how the order is processed internally or what mechanisms we are using. Abstraction does the work of simplifying the interface and the user only has to think about the input and output and not about the process.

Encapsulation:

Encapsulation is the process of binding the data with the code so that the data is not available externally or to unauthorized personnel. This is done by restricting access using access modifiers.

Inheritance:

Inheritance is the property by which a class is able to access the fields and methods of another class. The class inheriting these fields is called the subclass and the class whose fields are inherited is called the superclass. The sub-class can have additional fields and methods than those of the superclass. The purpose of inheritance is to increase code reusability and make the code more readable.

Polymorphism:

Polymorphism is the ability to have different methods with the same name but perform different tasks. It can be achieved through method overriding or method overloading. Method overriding is a subclass having a different implementation of the method than the parent class while method overloading is a function having different parameter types or number of parameters.

About


Languages

Language:Python 100.0%