Question

Design the logic for a program that allows a user to enter 10 numbers, then displays...

Design the logic for a program that allows a user to enter 10 numbers, then displays the element number, value in the element, and its squared.

The language is Python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have included my code and screenshots in this answer. In case, there is any indentation issue due to editor, then please refer to code screenshots to avoid confusion.

--------------------main.py--------------------


numbers = [] #Create an list for storing the numbers

for i in range(10):
   num = int(input("Enter number " + str(i+1) + ": ")) #read 10 numbers from the user
   numbers.append(num) #store each num in the list by appending


print("\n\nOutput")
for i in range(10): #for each number, print its position, value and square
   print("\nElement number " + str(i+1) + " : Value = " + str(numbers[i]) + ", Square = " + str(numbers[i]*numbers[i]))

--------------------Screenshot of main.py--------------------

-/python/temp/main.py - Sublime Text (UNREGISTERED) ti ) 12:02 AM main.py numbers [] #Create an list for storing the numbers

--------------------Output-----------------------

12:00 AM vs@ubuntu: -/python/temp vs@ubuntu:-/python/temps python3 main.py Enter number 1: 4 Enter number 2: 6 Enter number 3

-------------------------------------------------

I hope this helps you,

Please rate this answer if it helped you,

Thanks for the opportunity

Add a comment
Know the answer?
Add Answer to:
Design the logic for a program that allows a user to enter 10 numbers, then displays...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT