Input 10 numbers. Put it in a list. Turn every item of a list into its square. Print the result.
Expected output:
Enter Input 1
Enter Input 2
Enter Input 3
Enter Input 4
Enter Input 5
Enter Input 6
Enter Input 7
Enter Input 8
Enter Input 9
[1, 4, 9, 16, 25, 36, 49, 64, 81]
Note: the inputs are used for demonstration purposes only. Use yor own combination of inputs.
from random import randint
a = [randint(1, 1000) for _ in range(10)]
for i in a:
print(f'Enter Input {i}')
a = [i ** 2 for i in a]
print(a)
Comments
Leave a comment