-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPuzzles.py
70 lines (44 loc) · 1.29 KB
/
Puzzles.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
67
68
69
70
#for i in range(100+1):
# currentValue = "Fizz" if (i%3 == 0 and i%5 != 0 ) else ("Buzz" if ( i%3 != 0and i%5 == 0) else ("FizzBuzz" if(i%3 == 0 and i%5 == 0) else i) )
# print(currentValue)
'''
inp = input()
inputParts= str(inp).split(' ')
longestWord = ''
print(inputParts)
for word in inputParts:
longestWord = word if len(word) > len(longestWord) else longestWord
print('lw', longestWord)
#move capital letters to the fronts
inp = input()
newInput = ""
inpArray = list(inp)
print('new input', inpArray)
tmp = None
for i in range(len(inpArray)):
print('i',inp[i])
for j in range(len(inpArray)):
print('j',inp[j])
if inpArray[i].islower() and inpArray[j].isupper() :
tmp = inpArray[i]
inpArray[i]= inpArray[j]
inpArray[j] = tmp
break
newInput = ''.join(inpArray)
print('new input', newInput)
def multiply(x,y):
result = 0
while(y > 0):
result = result + x
y = y - 1
return result
print(multiply(2,3))
def digit_sum(number):
digitSum = 0
if(type(number) == int):
strNum = str(number)
for char in strNum:
digitSum = digitSum + int(char)
return digitSum
print(digit_sum(625))
'''