Aufgabe 3 optimiert

main
Thore Eichhorn 2022-11-11 23:11:51 +01:00
parent 03a0c352ae
commit 808aeba78f
1 changed files with 1 additions and 4 deletions

View File

@ -1,11 +1,9 @@
if __name__ == "__main__": if __name__ == "__main__":
# Aufgabe 3 # Aufgabe 3
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for i in range(0, 3): numbers = numbers[-3:] + numbers[:-3]
numbers.insert(0, numbers.pop())
print(numbers) print(numbers)
# Aufgabe 4 # Aufgabe 4
def split_chars_and_remove_duplicates(word: str): def split_chars_and_remove_duplicates(word: str):
string_list = list(word) string_list = list(word)
@ -31,7 +29,6 @@ if __name__ == "__main__":
print("The sorted list " + str(list_to_sort)) print("The sorted list " + str(list_to_sort))
# Aufgabe 6 # Aufgabe 6
def get_the_animal_sound(name_of_animal: str): def get_the_animal_sound(name_of_animal: str):
animal_dictionary = {"Lion": "Growl!", "Dog": "Barks!", "Cat": "Meow!"} animal_dictionary = {"Lion": "Growl!", "Dog": "Barks!", "Cat": "Meow!"}