-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkata4.py
66 lines (34 loc) · 1.14 KB
/
kata4.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#Shortest Word
#Simple, given a string of words, return the length of the shortest word(s).
#String will never be empty and you do not need to account for different data types.
def short(s):
a= s.split()
b=[]
for i in a:
b.append(len(i))
return min(b)
s="bitcoin take over the world maybe who knows perhaps"
print(short(s))
s="turns out random test cases are easier than writing out basic ones"
print(short(s))
s="lets talk about javascript the best language"
print(short(s))
s="i want to travel the world writing code one day"
print(short(s))
s="Lets all go on holiday somewhere very cold"
print(short(s))
print()
print()
print()
def short1(s):
return min(len(x) for x in s.split())
s="bitcoin take over the world maybe who knows perhaps"
print(short1(s))
s="turns out random test cases are easier than writing out basic ones"
print(short1(s))
s="lets talk about javascript the best language"
print(short1(s))
s="i want to travel the world writing code one day"
print(short1(s))
s="Lets all go on holiday somewhere very cold"
print(short1(s))