Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW8: Denis Martunovich #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/task_8_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Описать функцию fact2( n ), вычисляющую двойной факториал :n!! = 1·3·5·...·n, если n — нечетное;
# n!! = 2·4·6·...·n, если n — четное (n > 0 — параметр целого типа.
# С помощью этой функции найти двойные факториалы пяти данных целых чисел [01-11.2-Proc35]

def funk2(n: int) -> int:
res = 1
if n % 2 == 0:
for i in range(2, n, 2):
res *= i
else:
for i in range(1, n, 2):
res *= i
return res

print(funk2(5))











Comment on lines +16 to +26
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Удалите пробелы

17 changes: 17 additions & 0 deletions src/task_8_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Даны три слова.Выяснить, является лихоть одно из них палиндромом("перевертышем"), т.е.таким, которое
# читается одинаково слева направо и справа налево.
# Определитьфункцию, позволяющую распознавать слова палиндромы.[03 - 10.32]
a = ["lol","room","lex"]
def is_polidrome(string: str) -> str:
return string[::-1] == string

for i in a:
if is_polidrome(i):
print(f'{i} is polidrome')