forked from fenyx-it-academy/Class4-PythonModule-Week3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha3_W3.py
More file actions
20 lines (14 loc) · 883 Bytes
/
a3_W3.py
File metadata and controls
20 lines (14 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 3-alphabetical_order.py
# Write a function that takes an input of different words with hyphen (-) in between them and then:
# sorts the words in alphabetical order,
# adds hyphen icon (-) between them,
# gives the output of the sorted words.
# Example:
# Input >>> green-red-yellow-black-white
# Output >>> black-green-red-white-yellow
def alphabetical_order():
word = input("enter to different words with hyphen (-) in between: ").lower() # inputu kucuk harfe donusturdum.
word = word.split("-") # kelimeleri aradaki cizgilerden bolerek bir listede topladim.
word = sorted(word) # listeyi sort ettim.
return print("Output >>> ", *word, sep="-") # kelime listesini aralarina cizgi ekleyerek yazdirdim ve func.sonlandi.
alphabetical_order() # I called the function.