GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — salary-increase-decrease/salary_increase_decrease.py at main · AntonisParaskevis/salary-increase-decrease Expand file tree/ Copy pathsalary_increase_decrease.pyMore file actions 34 lines (26 loc) · 1.28 KB / Copy pathsalary_increase_decrease.pyFile metadata and controls34 lines (26 loc) · 1.28 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 while True: try: # Prompt the user to enter the current salary salary = float(input("Enter the current salary\n")) # If the user has entered either zero or a negative number, prompt them to enter a valid input if salary <= 0: print("Invalid entry, please enter a number greater than zero.") continue break except ValueError: # If the user has entered a non-numerical input, prompt them to enter a valid input print("Invalid entry, please enter a number greater than zero.") # Store the salary in the original_salary variable to save it for later use during the program's execution original_salary = salary # Increase the salary by 10% salary = salary + salary * 0.1 # Then, reduce the salary by 10% salary = salary - salary * 0.1 # Calculate the salary change percentage change_percentage = ((salary - original_salary) / original_salary) * 100 # Display the new salary print("New salary: $" + str(round(salary, 2)) + ".") # Display the salary change percentage, rounded to 2 decimals print("Salary change percentage: " + str(round(change_percentage, 2)) + "%.") # In the end, prompt the user to press Enter, in order to exit the program input("Press Enter to exit the program") |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |