Write a program to find the area of a rectangle

Assignment Help Python Programming
Reference no: EM132360672

Question

Rewrite the below program (ex5.py) to have a separate function for the area of a square, the area of a rectangle, and the area of a circle (3.14 * radius ** 2). This program should include a menu interface.

# By Amos Satterlee

print

def hello():

print 'Hello!'

def area(width, height):

return width * height

def print_welcome(name):

print 'Welcome,', name

name = raw_input('Your Name: ')

hello(),
print_welcome(name)
print
print 'To find the area of a rectangle,'
print 'enter the width and height below.'
print
w = input('Width: ')
while w print 'Must be a positive number'
w = input('Width: ')
h = input('Height: ')
while h print 'Must be a positive number'
h = input('Height: ')
print 'Width =', w, 'Height =', h, 'so Area =', area(w, h)

Reference no: EM132360672

Questions Cloud

Prepare a program to output a random number : Write a program to output a random number, which is divisible by 5 and 7, between 0 and 10 inclusive using random module and list comprehension.
Management concerns regarding current inventory system : Describe management concerns regarding the current inventory system. Evaluate Throsel-Teskey Drilling's inventory management system.
Write a program to take in telephone number that uses letter : Write a program to take in a telephone number that uses letters instead of numbers, such as 1-800-CALL-ATT. The program should use a function.
Discuss steps you would take to screen patient nutritionally : A 49 years old man was admitted to the emergency ward with general body weakness of 2 days duration. Patient was found to be slightly pale and very lethargic.
Write a program to find the area of a rectangle : Rewrite the below program to have a separate function for the area of a square, the area of a rectangle, and the area of a circle.
Analysis of consumer behaviour : Analysis of consumer behaviour for a specified purchase and recommendations for improving the customer experience throughout the consumer journey
Describe their essential inventory characteristics : Determine the types of inventories these companies currently manage and describe their essential inventory characteristics.
Write a program that asks the user their name : Write a program that asks the user their name, if they enter your name say "That is a nice name", if they enter "John Cleese" or "Michael Palin".
Determine level and strength of evidence for each article : Being able to articulate the information and successfully summarize relevant peer-reviewed articles in a scholarly fashion helps to support the student's.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a program that fills two lists with input from the use

Write a program that fills two lists with input from the user. One list should be students' first names and the second list should be students' last names.

  Why is software configuration management

Why is software configuration management considered an umbrella activity in software engineering?

  Write a program that uses all of your functions

Write a program that uses all of your functions from above to carry out an RSA key generation, encryption, and decryption.

  Create an application that displays he number of millimeters

Create an application that displays he number of millimeters that the ocean will have risen each year for the next 25 years.

  Write program to gather-display results of golf tournament

Write a program to gather, then display the results of the golf tournament played at the end of March. The Club president Mr. Martin has asked you

  Calculate the total displacement of the system of springs

Calculate the total displacement of the system of springs - You are free to use any linear system solver from chapter 6, including the solvers that are part of the SciPy and/or numpy packages.

  Convert between tempe in fahrenheit and temp in celsius

Write a Python application that allows the user to convert between temperatures in fahrenheit and temperatures in celsius.

  Let ll be a list of integers

Let LL be a list of integers. Use list comprehension to produce teh following lists. Each one should just take onel line. Anser questions as two comments.

  Write function preceding that takes a single character

Write function preceding that takes a single character as an input and returns a code for that character. Write function succeeding that takes single character.

  Compute second order differential equations for capacitor

Compute the 2nd order differential equations for capacitor voltage and inductor current in a series RLC circuit. Provide this derivation in your report.

  Design a python program to analyze weather data

Design a Python program to analyze weather data. Ask the user to enter the daily high temperature of 5 days. Store the termeratures in a list.

  Write a simple address book that lets save contact details

159.171 - Computational Thinking and Software Development Assignment. MASSEY UNIVERSITY. Write a simple address book that lets save contact details

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd