Compare commits
No commits in common. "380ff808e665fa5b36398d4e3c4a7fbcee410d57" and "23c0fa2e9f8fc68f98f06c3f065291afd3ef4060" have entirely different histories.
380ff808e6
...
23c0fa2e9f
4 changed files with 0 additions and 78 deletions
|
@ -1,60 +0,0 @@
|
||||||
employees = [
|
|
||||||
"Jemima Brown",
|
|
||||||
"Stuart Brown",
|
|
||||||
"Dexter Brown",
|
|
||||||
"Carrie Brown",
|
|
||||||
"Edwin Brown",
|
|
||||||
"Mattie Brown",
|
|
||||||
"Lena Brown",
|
|
||||||
"Bertha Brown",
|
|
||||||
"Bibi Brown",
|
|
||||||
"Nadine Brown",
|
|
||||||
] # Make the initial employees list
|
|
||||||
|
|
||||||
sub_list_1: list[str] = employees[
|
|
||||||
0:5
|
|
||||||
] # Splits the first 5 entries into the first sublist
|
|
||||||
sub_list_2: list[str] = employees[
|
|
||||||
5:10
|
|
||||||
] # Splits the second 5 entries into the second sublist
|
|
||||||
|
|
||||||
# New hire in subList2, 'Kriti Brown'
|
|
||||||
sub_list_2.append(
|
|
||||||
"Kriti Brown"
|
|
||||||
) # We're appending the string "Kriti Brown" into our second sublist
|
|
||||||
|
|
||||||
# Firing 'Stuart Brown'
|
|
||||||
sub_list_1.pop(
|
|
||||||
1
|
|
||||||
) # could also use .remove() if you wanted, We're removing the 2nd item in our first sublist
|
|
||||||
merge_list = (
|
|
||||||
sub_list_1 + sub_list_2
|
|
||||||
) # We're merging our sublists together into a main list
|
|
||||||
|
|
||||||
salary_list: list[int] = [
|
|
||||||
64000,
|
|
||||||
55000,
|
|
||||||
75000,
|
|
||||||
76000,
|
|
||||||
47000,
|
|
||||||
48000,
|
|
||||||
48000,
|
|
||||||
53000,
|
|
||||||
49000,
|
|
||||||
62000,
|
|
||||||
] # Our initial list of salaries for our employees
|
|
||||||
|
|
||||||
raised_salaries: list[int] = []
|
|
||||||
for salary in salary_list: # We're iterating through our salary list,
|
|
||||||
raised_salary: int = int(
|
|
||||||
salary * 1.04
|
|
||||||
) # We're multiplying our current salaries by 1.04
|
|
||||||
raised_salaries.append(
|
|
||||||
raised_salary
|
|
||||||
) # We're appending our new salaries into the raised salaries list
|
|
||||||
|
|
||||||
raised_salaries.sort(reverse=True) # This sorts our salaries in descending order
|
|
||||||
string = "\n".join(
|
|
||||||
[str(salary) for salary in raised_salaries[0:3]]
|
|
||||||
) # We convert the top 3 values into strings
|
|
||||||
print(string) # prints the string
|
|
|
@ -1,18 +0,0 @@
|
||||||
# ANSI color codes
|
|
||||||
BLUE = "\033[34m" # Blue
|
|
||||||
GREEN = "\033[32m" # Green
|
|
||||||
RESET = "\033[0m" # Reset to default color
|
|
||||||
|
|
||||||
|
|
||||||
def reverse_string(string: str) -> str:
|
|
||||||
wordlist: list[str] = string.split(" ") # Split the string by spaces into a list
|
|
||||||
wordlist.reverse() # Reverse the word list
|
|
||||||
return " ".join(wordlist) # Join the wordlist back into a string, with spaces between each element
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
string: str = input(
|
|
||||||
f"{BLUE}Input a string to reverse:{RESET} "
|
|
||||||
) # Allows us to input a string to reverse
|
|
||||||
result: str = reverse_string(string)
|
|
||||||
print(f"{GREEN}{result}{RESET}")
|
|
Loading…
Reference in a new issue