for-loop
, and a single print
statement.1 ≤ n ≤ 9
n=5
as input, print the following output:1
22
333
4444
Using math, it would be,
for i in range(1,n):
print i*(10**i-1)/9
Check repdigit for more information.
int
depending if you want .0
or not.for i in range(1, n):
print(int(i*(10**i-1)/9))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments