0

The square of a number

How to write the code of it in python? The number n is written k times. The resulting number is multiplied by itself. What is the result? Input The first number contains nonnegative integer n (n ≤ 777). The second line contains positive integer k (k ≤ 777). Output Print the resulting number. Input example #1 1 2 Output example #1 121 Input example #2 12 3 Output example #2 14692348944

3rd Nov 2017, 8:22 AM
Maria
Maria - avatar
6 odpowiedzi
+ 8
a=int(input("Enter number:")) b=int(input("Enter repeats:")) print((int(str(a)*b)**2))
3rd Nov 2017, 8:42 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 14
Homework? If you need help for making it just google how to do it.
3rd Nov 2017, 8:31 AM
qwerty
qwerty - avatar
+ 10
@Pegasus Don't give the answer. Just give the hints.
3rd Nov 2017, 2:31 PM
qwerty
qwerty - avatar
+ 3
@110000, I didn't find the answer there
3rd Nov 2017, 8:35 AM
Maria
Maria - avatar
+ 2
There are two ways to do this. I am sure you would find it hard to follow up with the string method. I will post an easy trick soon.
3rd Nov 2017, 9:32 AM
Itz_Arnab
Itz_Arnab - avatar