Question

This is for Pycharm a python course. Can I get some help doing this and understand it?

⑤ : ib tps://canvas.pasadena.edu/courses/1032754/assi a ☆ 西%N m Crowfall. Th O computing, with-c- O PHP Tutorial | SoloL onto

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import math
def main():
   while(1):
       print("Welcome to volume and surface area calculator")
       print("please choose one of the following options")
       print("1.volume of sphere\n2.surface area of sphere\n3.volume of cylinder\n4.surface area of cylinder\n5.volume of cone\n6.surface area of cone\n7.exit\n")
       ch = input("enter your choice:\t")
       if(ch==1):
           r = input("enter radius of sphere:\t")
           sphereVolume(r)
       elif(ch==2):
           r = input("enter radius of sphere:\t")
           sphereSurface(r)
       elif(ch==3):
           r = input("enter radius of cylinder:\t")
           h = input("enter height of cylinder:\t")
           CylinderVoume(r,h)
       elif(ch==4):
           r = input("enter radius of cylinder:\t")
           h = input("enter height of cylinder:\t")
           CylinderSurface(r,h)
       elif(ch==5):
           r = input("enter radius of cone:\t")
           h = input("enter height of cone:\t")
           coneVolume(r,h)
       elif(ch==6):
           r = input("enter radius of cone:\t")
           h = input("enter height of cone:\t")
           coneSurface(r,h)
       elif(ch==7):
           print("Thank you for using calculator")
           break
       else:
           print("enter correct option")
      
def sphereVolume(r):
   volume = (4/3)*(math.pi)*(r*r*r)
   print("volume of sphere is:\t"+str(volume))

def sphereSurface(r):
   surface = 4*(math.pi)*(r*r)
   print("surface area of sphere is:\t"+str(surface))
def CylinderVoume(r,h):
   volume = (math.pi)*(r*r)*h
   print("volume of cylinder is:\t"+str(volume))
def CylinderSurface(r,h):
   surface = (2*(math.pi)*r*h)+(2*(math.pi)*r*r)
   print("surface area of cyclinder is:\t"+str(surface))
def coneVolume(r,h):
   volume = ((math.pi)*(r*r)*h)/3
   print("volume of cone is:\t"+str(volume))
def coneSurface(r,h):
   surface = ((math.pi)*r)*(r+(math.sqrt((h*h)+(r*r))))
   print("surface area of cone is:\t"+str(surface))
main()

deepika@deepika-TravelMate-P243-M: /Desktop File Edit View Search Terminal Help deepíka@deepika-TravelMate-P243-H.-/DesktopSdeepika@deepika-TravelMate-P243-M: /Desktop File Edit View Search Terminal Help enter your choice: enter radius of cylinder edeepika@deepika-TravelMate-P243-M: /Desktop File Edit View Search Terminal Help 4.surface area of cylinder 5.volume of cone 6If you have any doubts please comment and please don't dislike.

Add a comment
Know the answer?
Add Answer to:
This is for Pycharm a python course. Can I get some help doing this and understand...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Python 3+ for Question P5.9 Instructions: Use one main() to call each of the functions...

    Using Python 3+ for Question P5.9 Instructions: Use one main() to call each of the functions you created. Only use one value of r and h for all the function. Ask the user for the r and h in the main() as an input, and h for all the functions. You should put the functions for areas in a separate file. ​ For example, firstDigtec7ze Write a function e digits n) (returning the number of digits in the argument returning...

  • Please do this in C language. Thank you 1. Write the following functions that compute the...

    Please do this in C language. Thank you 1. Write the following functions that compute the volume and surface of a sphere with radius r; a cylinder with circular base with radius r and height h; and a cone with circular base with radius r and height h. Place these functions in appropriate class. Define n (PI) as a constant variable equals to 3.14 then use it in the functions. float sphereVolume(float r) float sphereSurface(float r) float cylinderVolume(float r, float...

  • Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================")...

    Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================") print(" Baseball Team Manager") print("MENU OPTIONS") print("1 - Calculate batting average") print("2 - Exit program") print("=====================================================================")    def convert_bat(): option = int(input("Menu option: ")) while option!=2: if option ==1: print("Calculate batting average...") num_at_bats = int(input("Enter official number of at bats: ")) num_hits = int(input("Enter number of hits: ")) average = num_hits/num_at_bats print("batting average: ", average) elif option !=1 and option !=2: print("Not a valid...

  • Can someone help me with this coding question. I cannot get this to run properly. Write...

    Can someone help me with this coding question. I cannot get this to run properly. Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of π. The program should use PI and the functions listed in Table 6-1 to accomplish the following: Output the value of √π . Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs...

  • Please help me to do my assignment it should be python. Thank you Write a menu-driven...

    Please help me to do my assignment it should be python. Thank you Write a menu-driven program for Food Court. (You need to use functions!) Display the food menu to a user (Just show the 5 options' names and prices - No need to show the Combos or the details!) Ask the user what he/she wants and how many of it. (Check the user inputs) AND Use strip() function to strip your inputs. Keep asking the user until he/she chooses...

  • ******** IN JAVA ********* I have a program that I need help debugging. This program should...

    ******** IN JAVA ********* I have a program that I need help debugging. This program should ask a user to input 3 dimensions of a rectangular block (length, width, and height), and then perform a volume and surface area calculation and display the results of both. It should only be done using local variables via methods and should have 4 methods: getInput, volBlock, saBlock, and display (should be void). I have most of it written here: import java.util.*; public class...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  • So I have a question in regards to my program. I'm learning to program in C...

    So I have a question in regards to my program. I'm learning to program in C and I was curious about the use of functions. We don't get into them in this class but I wanted to see how they work. Here is my program and I would like to create a function for each of my menu options. I created a function to display and read the menu and the option that is entered, but I would like to...

  • how to make my code of python work probely my q is how to write a...

    how to make my code of python work probely my q is how to write a code to find the average actual water level, average error by using python and my program should be flexible where user can select the column no. If you can see in the main program, it asked which column to know the maximum or average, the column number is passed to the function. The function should look which column to do. #THIS PROGRAMMING IS ABLE...

  • I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instruction...

    I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT