-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.py
46 lines (39 loc) · 1.13 KB
/
functions.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functions."""
def my_range(*args):
"""Range function."""
tuple_length = len(args)
range_list = []
if tuple_length == 1:
x = 0
while x < args[0]:
range_list.append(x)
x += 1
return range_list
elif tuple_length == 2:
x = args[0]
while x < args[1]:
range_list.append(x)
x += 1
return range_list
elif tuple_length == 3:
x = args[0]
while x < args[1]:
if x % args[2] == 0:
range_list.append(x)
x += 1
return range_list
else:
raise TypeError
"""print(my_range(0, 10, 2, 4))"""
def adt():
"""Advert function."""
words = {}
invitation_text = 'Witaj {firstname} {lastname}, zapraszam Cię do skorzystania z {adjective} ofery na {thing}!!!'
words['firstname'] = str(input('Write firstname: '))
words['lastname'] = str(input('Write lastname: '))
words['adjective'] = str(input('Write adjective: '))
words['thing'] = str(input('Write thing: '))
print(invitation_text.format(**words))
adt()