1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env python
'''
----------------------------------------
AUTHOR: Robert DiCicco
DATE : 2023-05-01
Challenge 215 Odd One Out ( Python )
----------------------------------------
'''
words = [["abc","xyz","tsu"],["rat", "cab", "dad"],["x", "y", "z"]]
for wds in words:
cnt = 0
print("Input: @words = ",wds)
for w in wds:
w_sorted = ''.join(sorted(w, key=str.lower))
if w != w_sorted:
cnt += 1
print("Output: ",cnt,"\n")
'''
----------------------------------------
SAMPLE OUTPUT
python .\OddOneOut.py
Input: @words = ['abc', 'xyz', 'tsu']
Output: 1
Input: @words = ['rat', 'cab', 'dad']
Output: 3
Input: @words = ['x', 'y', 'z']
Output: 0
----------------------------------------
'''
|