forked from werhereitacademy/Python_Modul_Week_3
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhackerrank.py
More file actions
27 lines (25 loc) · 756 Bytes
/
hackerrank.py
File metadata and controls
27 lines (25 loc) · 756 Bytes
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
# # https://www.hackerrank.com/challenges/find-digits/problem
def findDigits(n):
# Write your code here
str_n = str(n)
dividers = 0
for i in str_n:
if i != "0" and n % int(i) == 0:
dividers +=1
return dividers
"""---------------------------------------------"""
# # https://www.hackerrank.com/challenges/capitalize/problem
def solve(s):
return_s = ""
uppercase_ = True
for i in s:
if (i != " ") and not i.isnumeric() and uppercase_ :
return_s += i.upper()
uppercase_ = False
elif i == " ":
return_s += i
uppercase_ = True
else:
return_s += i
uppercase_ = False
return return_s