diff --git a/lesson_1/solution_1.py b/lesson_1/solution_1.py new file mode 100644 index 0000000..73a4234 --- /dev/null +++ b/lesson_1/solution_1.py @@ -0,0 +1,2 @@ +numbers = list(map(float, input().split())) +print(sum(numbers)) \ No newline at end of file diff --git a/lesson_1/solution_2.py b/lesson_1/solution_2.py new file mode 100644 index 0000000..b463fca --- /dev/null +++ b/lesson_1/solution_2.py @@ -0,0 +1,5 @@ +st = input() +while True: + rule = input() + st = st.replace(rule[0], rule[3]) + print(st) \ No newline at end of file diff --git a/lesson_1/solution_3.py b/lesson_1/solution_3.py new file mode 100644 index 0000000..7b7b0bc --- /dev/null +++ b/lesson_1/solution_3.py @@ -0,0 +1,3 @@ +numbers = list(map(float, input().split())) +for i in numbers: + print(str(int(abs(i))) + ' ', end = '') \ No newline at end of file diff --git a/lesson_1/solution_4.py b/lesson_1/solution_4.py new file mode 100644 index 0000000..a38d524 --- /dev/null +++ b/lesson_1/solution_4.py @@ -0,0 +1,5 @@ +numbers = list(map(float, input().split())) +summ = 0 +for i in numbers: + summ += i*i +print(summ) \ No newline at end of file diff --git a/lesson_1/solution_5.py b/lesson_1/solution_5.py new file mode 100644 index 0000000..f4fe531 --- /dev/null +++ b/lesson_1/solution_5.py @@ -0,0 +1,13 @@ +s = list(input()) +d = int(input()) % 26 #delta + +for i in range(len(s)): + tmp = d + if s[i] == ' ': + continue + elif ord(s[i]) + tmp > ord('z') or ('A' <= s[i] <= 'Z') and (ord(s[i]) + tmp > ord('Z')): + tmp -= 26 + s[i] = chr(ord(s[i]) + tmp) + +s = ''.join(s) +print(s) \ No newline at end of file