xonecas.io
387
Pe

python-exercices / files

python-exercices / level_two / ex_15.py

606 bytes
1#!/usr/bin/env python3
2
3# Question 15
4# Level 2
5
6# Question:
7# Write a program that computes the value of a+aa+aaa+aaaa with a given digit as the value of a.
8# Suppose the following input is supplied to the program:
9# 9
10# Then, the output should be:
11# 11106
12
13# Hints:
14# In case of input data being supplied to the question, it should be assumed to be a console input.
15
16
17number = input('Please enter a single number:\n')
18result = 0
19
20for i in range(1, 5):
21    new_number = number * i  # number is a str here, it should produce a srquence of the same char
22    result = int(new_number) + result
23
24print(result)