Python. This program is not finished. It lost a if condition. How to finish this program? Thank you.
def area(length,width):
return length*width
def main():
print("this program calculates the results of formulas")
print("For the area pf a rectangle ,type Area \n followed by the length and width of the rectangle")
print("For example-area 4 6") userInput=input(">>>")
createlist=userInput.split(" ")
print("creatlist[0]="+creatlist[0])
print("createlist[1]="+createlist[1])
print("createlist[2]="+createlist[2])
def area(length,width):
return length*width
def main():
print("this program calculates the results of formulas")
print("For the area pf a rectangle ,type Area \n followed by the length and width of the rectangle")
print("For example-area 4 6")
userInput=input(">>>")
createlist=userInput.split(" ")
print("createlist[0]="+createlist[0])
print("createlist[1]="+createlist[1])
print("createlist[2]="+createlist[2])
if len(createlist)==3:
print(createlist[0],"=",area(int(createlist[1]),int(createlist[2])))
else:
print("Invalid input")
main()

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Python. This program is not finished. It lost a if condition. How to finish this program?...
Python only please, thanks in advance.
Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...
Design in Python (pseudocode) and implement (source code) a program (name it MyRectangle) that defines the following 3 methods: Method isValid() returns true if the sum of the width and height is greater than 30 Method Area() returns the area of the rectangle if it is a valid rectangle Method Perimeter() returns the perimeter of the rectangle if it is a valid rectangle The main method of MyRectangle prompts the user to enter the width and height of a rectangle...
Python only please, thanks in advance.
Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...
Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....
I need help with my python class. thanks! Question 12 Code Example 4-4 main program: import arithmetic as a def multiply(num1, num2): product = num1 * num2 result = a.add(product, product) return result def main(): num1 = 4 num2 = 3 answer = multiply(num1, num2) print("The answer is", answer) if __name__ == "__main__": main() arithmetic module: def add(x, y): z = x + y return z Refer to Code...
PYTHON Fractal Drawing We will draw a recursively defined picture in this program. Create a function def fractal(length, spaces). This function will print out a certain number of stars * and spaces. If length is 1 print out the number of spaces given followed by 1 star. If the length is greater than one do the following: Print the fractal pattern with half the length and the same number of spaces. Print the number of spaces given followed by length...
Write a program that collects the dimensions of two rectangles. For each rectangle, the program collects the width and length. Then, the program should print one of the following messages depending on the relative values of the rectangle sizes: - Rectangle 1 is bigger than Rectangle 2. - Rectangle 1 is the same size as Rectangle 2. - Rectangle 2 is bigger than Rectangle 1. For example, consider the sample output of the proposed program (the bold font represents user...
import math ''' Finish the code below as described. Use the completed class Square as an example. ''' class Square: ''' Each Square has a width and can calculate its area, its perimeter, and return a string representation of itself. ''' def __init__(self, width): ''' (float) -> None Create a new Square with the given width. ''' self.width = width def get_area(self): ''' () -> float Return this square's area. ''' return self.width*self.width def get_perimeter(self): ''' () -> float Return...
(PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1 - 4): If the user enters 1, the program should ask for the radius of the circle and then display its area. If the user enters 2, the program should ask for the length and width of...
Write a program in Python that computes the interest accrued on an account. You can modify the “futval.py” program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute...