Giter VIP home page Giter VIP logo

mhs-4ever / python-player-salary-calculation-program Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 98 KB

This respiratory contain a .py file containing the code for player salary calculation according to his skills and the complete documentation of the code.

Python 100.00%
python python-project python-project-beginner salary-calculator salary-prediction player-salary-calculator python-salary-calculator

python-player-salary-calculation-program's Introduction

python-player-salary-calculation-program

This respiratory contain a .py file containing the code for player salary calculation according to his skills and the complete documentation of the code. Importing Modules: The first two lines of the code are importing the necessary modules that will be used throughout the program. The datetime module is imported to calculate the age of the player using their date of birth, and the tabulate module is imported to display the data in a tabular format.

Initializing Variables: Two lists are declared in this part of the code, player_salaries and player_rates. These lists store the salaries and the corresponding player rates, respectively.

Function to Calculate Player Rating: The calculate_rating() function is defined in this part of the code. It prompts the user to input the player's skills in the range of 0 to 5, and then it calculates the overall rating of the player based on the given formula. It also prints the sum of the skills and the overall rating on the output screen.

Function to Calculate Player Salary: The calculate_salary() function is defined in this part of the code. It calculates the salary of the player based on their overall rating. The salary is determined by looking up the player rates in the player_rates list and then matching them with the corresponding salary values in the player_salaries list. Finally, the function sets the player_salary variable to the appropriate value.

Main Function: The main() function is defined in this part of the code. It prompts the user to enter the player's name, date of birth, and skill levels. It then calculates the player's age based on their date of birth and calls the calculate_rating() and calculate_salary() functions to determine the player's overall rating and salary, respectively. Finally, it displays all the information in a table using the tabulate module.

Creating Player Data: In this part of the code, a dictionary named player_data is created to store all the player information. The player_id is used as the key, and the player's name, date of birth, age, overall rating, and salary are stored as values.

Output: The final part of the code displays the player data in a tabular format using the tabulate module. The table shows the player's name, date of birth, age, overall rating, and salary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.