Skip to content

Commit 2369e30

Browse files
Function
1 parent daa7821 commit 2369e30

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

10X/Python/FUNCTION/Greater.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def signum(number):
2+
# you can start from here.
3+
4+
if (number>0):
5+
return 1
6+
elif(number==0):
7+
return 0
8+
else:
9+
return -1
10+
11+
12+
13+
14+
### Please do not edit the code below this line.
15+
16+
if __name__ == "__main__":
17+
test_input = float(input())
18+
print(signum(test_input))

10X/Python/FUNCTION/StringRepeat.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
def string_repeat(string_to_repeat, repeat):
2+
# Write from here
3+
s=""
4+
a=int(repeat)
5+
6+
s=(string_to_repeat+" ")*(a-1)
7+
s+=string_to_repeat
8+
return s
9+
10+
'''
11+
s=""
12+
for i in range(int(repeat)-1):
13+
s+=string_to_repeat+" "
14+
s+=string_to_repeat
15+
return(s)
16+
'''
17+
"""
18+
s=''
19+
for i in range(int(repeat)-1):
20+
s+=string_to_repeat+" "
21+
s=s+string_to_repeat
22+
return(s,repeat)
23+
"""
24+
25+
26+
27+
# Please don't change anything below this line.
28+
# You don't have to worry about reading input, just fill the function above.
29+
30+
if __name__ == "__main__":
31+
input_string = input()
32+
input_number = input()
33+
print(string_repeat(input_string, input_number))

10X/Python/FUNCTION/String_Index.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def printer(i_list):
2+
for i in i_list:
3+
print_with_index(i, i_list[i])
4+
5+
6+
7+
8+
# Do not change anything below this line
9+
def print_with_index(index, current_string):
10+
print(index, current_string)
11+
12+
if __name__ == "__main__":
13+
count = int(input())
14+
input_list = [input() for i in range(count)]
15+
printer(input_list)

0 commit comments

Comments
 (0)