From 808aeba78fb6c5fbf5fa9a196420bef42bf1cc30 Mon Sep 17 00:00:00 2001 From: Thore <2120752@stud.hs-mannheim.de> Date: Fri, 11 Nov 2022 23:11:51 +0100 Subject: [PATCH] Aufgabe 3 optimiert --- s1_a53_6.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/s1_a53_6.py b/s1_a53_6.py index 10ec606..06a04ce 100644 --- a/s1_a53_6.py +++ b/s1_a53_6.py @@ -1,11 +1,9 @@ if __name__ == "__main__": # Aufgabe 3 numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - for i in range(0, 3): - numbers.insert(0, numbers.pop()) + numbers = numbers[-3:] + numbers[:-3] print(numbers) - # Aufgabe 4 def split_chars_and_remove_duplicates(word: str): string_list = list(word) @@ -31,7 +29,6 @@ if __name__ == "__main__": print("The sorted list " + str(list_to_sort)) - # Aufgabe 6 def get_the_animal_sound(name_of_animal: str): animal_dictionary = {"Lion": "Growl!", "Dog": "Barks!", "Cat": "Meow!"}