P
P
Python Classroom
Ask or search…
K

Problems

Problem 1

Ask the user for a maximum number.
Use a for loop to display a table showing the numbers 1 through max and their cubes (raised to the third power).
Start your code with the heading:
print("Number\tCubed")

Problem 2

Create a table of values (x,y) for the x values from -3 to 3 for the function:
f(x)=13x2+5f(x)=13x^2+5

Problem 3

Create a table of values (x,y) for the x values from -4 to 4 for the equation:
y=2x35x+1y=2x^3-5x+1

Problem 4

Running on a treadmill, you burn 4.5 calories per minute. Ask the user how many minutes they want to run on the treadmill. Display the number of calories burned from 1 to the number they want to run till (including that number).

Problem 5

The distance a vehicle travels can be calculated as:
distance=speedtimedistance = speed * time
Write Python code that asks the user for the speed of a vehicle (in miles per hour) and the number of hours it has traveled. Display a table with the distance the vehicle has traveled for each hour, starting at one, until the number of hours traveled.

Problem 6

At a college, the tuition for a full-time student is $8000 per semester. It was announced that the tuition will increase by 5% each year. How many years will it take for you reach college? What is the projected amount of tuition each year till then?