Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python The code at the bottom is what i have currently and it is not working and I need some help. Additionally I need to

Python

The code at the bottom is what i have currently and it is not working and I need some help. Additionally I need to add a main function some how too. Thank you

In this assignment, you will write a program that prints a table of squares and cubes of a given range of numbers.

Specifically, write program that

  • has a function called square, that takes a single argument and returns square of that argument.
  • has a function called cube, that takes a single argument and returns cube of that argument.
  • has a main function, that
    • Asks the user for starting number
    • Asks the user for ending number, validates that it is greater than the starting number
    • Uses square and cube functions to print a table of squares and cubes for the range (starting, ending)
  • finally calls the main function

See the sample run below. Submit the program in a file with a name of the form first_last_squarecube.py. Be sure to add the comment block at the top stating your name, date, assignment details etc.

image text in transcribed

image text in transcribed

Python 3.6.3 Shell File Edit She Debug Options Window Help ========== RESTART: C:\Code\Python\ Playground\ squares and cubes .py ======= Welcome to the square-cube table generator Please enter the starting number: 3 Please enter the ending number: 8 Number Sqruared Cubed 16 25 36 49 27 64 125 216 343 >> main () Welcome to the square-cube table generator Please enter the starting number 60 Please enter the ending number: 66 Number Sqruared Cubed 3600 3721 3844 3969 4096 4225 216000 226981 238328 250047 262144 274625 60 61 64 Ln: 51 Col: 0 #This assignment is a program that asks the user for set of numbers and print s a table of squares and cubes of a given range of numbers #de fining a function calle cube and square def square (i) return (i*i) def cube (i) return (i*i*i) #Prints the welcome me s s age print ("Welcome to the square-cube table generator!!") #assigning two variables while asking the user for input startl - int (input ("Please enter the starting number:\t") tart2int (input ("Please enter the starting number:t")) print () print ("Number Squared Cubed") print () for i in range (startl,start2) print (i,"t",square (i),"t", cube (i))

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions