We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fc44e0 commit 06c9945Copy full SHA for 06c9945
100 python exercises - ex15.py
@@ -11,18 +11,19 @@
11
# 11106
12
#
13
14
-# Function:
+# Function: (taking the assignment a bit further!)
15
# 1 - Ask a digit
16
# 2 - Ask how many time it should be added (2--> a + aa / 4--> a + aa + aaa + aaaa)
17
18
+# Ask the user a digit, and how many times it should be repeated then added to the other repetitions
19
20
def conv(digit, repeats):
21
start = range(1,repeats+1)
22
sequence = []
23
count = 0
- for p in start:
24
+ for p in start: # Create a list of integers of the digit repeated p times
25
sequence.append(int(str(digit) * p))
- for p in sequence:
26
+ for p in sequence: # Add the resulting values
27
count = count + p
28
return count
29
0 commit comments