-
-
Save prodevo/ec1e1a29bc37a8e36675c98dc1d9d06c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def draw_line(a, b, c): | |
if c == True: | |
print(b*a) | |
else: | |
for i in range(a): | |
print(b) | |
draw_line(20, '@', False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def draw_rectangle(l, h, r, s): | |
print(l*r) | |
for i in range(h - 2): | |
print(r + s * (l-2) + r) | |
print(l*r) | |
draw_rectangle(5, 4, '*', '@') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = int(input('vvedit chyslo: ')) | |
def is_common(a): | |
c = 0 | |
for i in range(1, a + 1): | |
if a % i == 0: | |
c += 1 | |
if c == 2 or a == 1: | |
return(True) | |
else: | |
return(False) | |
print(is_common(a)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = int(input('vvedit chyslo 1: ')) | |
b = int(input('vvedit chyslo 2: ')) | |
def is_common(a, b): | |
c = 0 | |
if a > b: | |
for i in range(b + 1, a): | |
c += i | |
elif a < b: | |
for i in range(a + 1, b): | |
c += i | |
return c | |
print(is_common(a, b)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [3, 4, 5, 6, 7] | |
def is_common(a): | |
c = 0 | |
for i in range(len(a)): | |
c += a[i] | |
c /= len(a) | |
return c | |
print(round(is_common(a), 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [3, 4, 5, 6, 7] | |
def is_common(a): | |
print(max(a), a.index((max(a)))) | |
print(min(a), a.index((min(a)))) | |
is_common(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment