-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathcirculate.py
More file actions
45 lines (35 loc) · 790 Bytes
/
circulate.py
File metadata and controls
45 lines (35 loc) · 790 Bytes
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
def circulate(a, b, c):
"""circulate between three variables, three times
@author kgashok
@param a is a integer
@param b is a integer
@param c is a integer
@return nothing
"""
i = 3
while i:
t = a
a = b
b = c
c = t
print(a, b, c)
i -= 1
print("Enter 3 values")
a, b, c = input().split()
print()
circulate(a, b, c)
def circulate_list(alist):
"""circulate 'n' elements in a list, n times
@author kgashok
@param alist contains the 'n' elements
@return nothing
"""
i = len(alist)
while i:
first = alist.pop(0)
alist.append(first)
print(*alist, sep=", ")
i -= 1
alist = input("enter multiple values\n").split()
print()
circulate_list(alist)