Question

Write a Python program to calculate the area of a circle. The user needs to input...

Write a Python program to calculate the area of a circle. The user needs to input the value of the radius of the circle.

area = 3.14 x radius x radius

You should use a function named circlearea to perform the calculation

3.

Write a Python program to calculate the area of a square. The user needs to input the value of the length of the square.

area = len*len

You should use a function named squarearea to perform the calculation

java please

Homework Answers

Answer #1

def circlearea(radius):
return 3.14*radius*radius

radius=float(input('Enter the radius: '))
area=circlearea(radius)
print('Area=',area)

def squarearea(length):
return length*length

length=float(input('Enter the length of square: '))
area=squarearea(length)
print('Area=',area)

Know the answer?
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
Similar Questions
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
Write a python program that calculates the area of triangle. The user will be asked to...
Write a python program that calculates the area of triangle. The user will be asked to enter the base (b) and the height (h). The formula to calculate the area is: Triangle_area=(bh)/2 Note: the program should print the area to the user: (for example: the area of the triangle is: 34.3)
Write a program in python to display all the consonant in the user input. E.g. user...
Write a program in python to display all the consonant in the user input. E.g. user input: Hello Good Day to you. Output: consonant H = 1 consonant l = 2 consonant G = 1   consonant d = 1 consonant D = 1 etc
Please use Python programming language to write a client program and a server program, so that...
Please use Python programming language to write a client program and a server program, so that these two programs communicate through a TCP connection based on the following scenario: Both of the client program and the server program are running on the same localhost. The client program prompts the user to enter the radius of a circle and pass it to the server program. The server program computes the area of this circle and passes it to the client program....
Write a Python program using that takes a number as input and then prints if the...
Write a Python program using that takes a number as input and then prints if the number is even or odd. The program should use a function isEven that takes a number as a parameter and returns a logical value true if the number is even, false otherwise.
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...
Write a PYTHON program that takes the radius of a sphere (a floating-point number) as input...
Write a PYTHON program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s surface area. The Surface Area of a Sphere is Surface Area = 4πr² Surface Area = 4 * PI * radius * radius
step by step in python please The program will prompt the user as to whether you...
step by step in python please The program will prompt the user as to whether you want to convert from Celsius to Fahrenheit or from Fahrenheit to Celsius Write it so each conversion is contained within its own function (i.e., one function to do the math in one direction, a second to do the math in the other direction) These two functions should just have the input temperature as a parameter and return the output temperature in the other units....
Write a Python program that will ask the user to enter the masses of two particles...
Write a Python program that will ask the user to enter the masses of two particles (particle one and particle two) and particle 1’s initial velocity (v1). Assume particle two is at rest. The program should calculate the scattering angle and velocity for particle 2 as a function of the scattering angle and resulting velocity of particle 1
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except that it only accepts the specified type of input. The function takes two arguments: r prompt: str r type: int, float, str The function will keep prompting for input until correct input of the specified type is entered. The function returns the input. If the input was specified to be a number ( float or int), the value returned will be of the correct...