Skip to content

Commit 06c9945

Browse files
committed
Update 100 python exercises - ex15.py
1 parent 0fc44e0 commit 06c9945

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

100 python exercises - ex15.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
# 11106
1212
#
1313

14-
# Function:
14+
# Function: (taking the assignment a bit further!)
1515
# 1 - Ask a digit
1616
# 2 - Ask how many time it should be added (2--> a + aa / 4--> a + aa + aaa + aaaa)
1717

18+
# Ask the user a digit, and how many times it should be repeated then added to the other repetitions
1819

1920
def conv(digit, repeats):
2021
start = range(1,repeats+1)
2122
sequence = []
2223
count = 0
23-
for p in start:
24+
for p in start: # Create a list of integers of the digit repeated p times
2425
sequence.append(int(str(digit) * p))
25-
for p in sequence:
26+
for p in sequence: # Add the resulting values
2627
count = count + p
2728
return count
2829

0 commit comments

Comments
 (0)