Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: Compute n * * x In this part of the assignment, you will write a program that, when given positive integers n and x

Task: Compute n ** x
In this part of the assignment, you will write a program that, when given positive integers n and x, will create a list containing 0x,1x,2x,3x,..., nx.
When the program is executed, it will ask the user to enter 2 positive integers n and x, and it will store it into 2 variable: n and x. This is done for you in the code we have provided at the top of the program (between the two ### DO NOT MODIFY ### comments). Below the # YOUR CODE HERE comment, you will write the code to create a list called powers containing the following n +1 items:
powers[0] should be 0** x
powers[1] should be 1** x
powers[2] should be 2** x
...
powers[n] should be n ** x
At the bottom of the program (between the two ### DO NOT MODIFY ### comments), we provide code to print powers in order to display the contents of powers to you (in order to help you debug).
For example, if you run your program as follows:
Enter positive integer n: 6
Enter positive integer x: 2
Your program should print the following:
[0,1,4,9,16,25,36]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

What are the advantages and disadvantages of BYOD?

Answered: 1 week ago

Question

WHAT IS AUTOMATION TESTING?

Answered: 1 week ago

Question

What is Selenium? What are the advantages of Selenium?

Answered: 1 week ago

Question

Explain the various collection policies in receivables management.

Answered: 1 week ago

Question

6. What data will she need?

Answered: 1 week ago

Question

1. How did you go about making your selection?

Answered: 1 week ago