diff options
author | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-03-19 09:19:11 +0200 |
---|---|---|
committer | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-03-19 09:19:11 +0200 |
commit | 556402c0fdbab1f1af0a1e9923a859d5c12618b5 (patch) | |
tree | cd9eb4ada139a9fa72e83d759f0062b3918a4f8a /9618-42-mj-2023/Question1_J2023.py | |
parent | ac44ac75508b72ca63e08875a623f992fe372fc2 (diff) | |
download | cs-y13-556402c0fdbab1f1af0a1e9923a859d5c12618b5.tar.gz cs-y13-556402c0fdbab1f1af0a1e9923a859d5c12618b5.tar.bz2 cs-y13-556402c0fdbab1f1af0a1e9923a859d5c12618b5.zip |
funniness
Diffstat (limited to '9618-42-mj-2023/Question1_J2023.py')
-rw-r--r-- | 9618-42-mj-2023/Question1_J2023.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/9618-42-mj-2023/Question1_J2023.py b/9618-42-mj-2023/Question1_J2023.py new file mode 100644 index 0000000..1e2e2bd --- /dev/null +++ b/9618-42-mj-2023/Question1_J2023.py @@ -0,0 +1,29 @@ +#1a +global Animals +Animals = [None for i in range(10)] # String array, initialise to None to imply emptiness +#1b +Animals = [ + "horse", + "lion", + "rabbit", + "mouse", + "bird", + "deer", + "whale", + "elephant", + "kangaroo", + "tiger" +] +#1c +def SortDescending(): + ArrayLength = len(Animals) + for x in range(0, ArrayLength): + for y in range(0, ArrayLength - x - 1): + if Animals[y][0] < Animals[y+1][0]: + Temp = Animals[y] + Animals[y] = Animals[y+1] + Animals[y+1] = Temp +#1di +SortDescending() +for i in range(len(Animals)): + print(Animals[i])
\ No newline at end of file |