Python 3: Please follow the respective rubric for the following function definition.
Rubric:
Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks
Note: Please maintain proper code spacing (indentation), just copy the code part and paste it in your compiler/IDE directly, no modifications required.
#code
#method to print the rectangle def print_rectangle(length, width, fillChar, hollow): #looping through each row for i in range(length): #looping through each column for j in range(width): #if hollow is False, simply printing fillChar if not hollow: print(fillChar, end='') else: # otherwise checking if current position is at the edge if i==0 or j==0 or i==length-1 or j==width-1: #printing fillChar print(fillChar, end='') else: #printing a blank space print(' ', end='') #printing line break print() #method to read values from user and print a rectangle def make_rectangle(): #initializing length to -1 length = -1 #looping until a valid length is entered while length < 0 or length > 20: #reading and validating length length = int(input("Enter a valid length between 1 and 20: ")) if length < 0 or length > 20: print("Invalid length, try again.") #doing the same for width width=-1 while width<0 or width>80: width=int(input("Enter a valid width between 1 and 80: ")) if width<0 or width>80: print("Invalid width, try again.") #reading fill char c=input("Enter a fill character: ") #reading fill status. if input is 'y' or 'Y', the rectangle will be hollow #anything else, rectangle will be filled hollow=input("rectangle needs to be hollow? (y/n): ").lower()=='y' print() #printing a blank line #printing rectangle print_rectangle(length, width, c,hollow) #testing the above method make_rectangle()
#output 1
#output 2
Python 3: Please follow the respective rubric for the following function definition. Rubric: Rectangle Shape You...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
C Programming Complete the following function by writing C statements that correspond to the description in each comment in the code. #include <stdio.h> intmain() { // Declare a floating point variable to store a rectangle’s width // Declare a floating point variable to store a rectangle’s length // Declare a third floating point variable that will store the area of the rectangle. // Prompt the user to enter a width for the rectangle. // Get the user’s input, and store...
Python 2.7.14 Programming Assignment Shape Drawing With Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS THIS ASSIGNMENT IS FOR PYTHON 2.7.14. ONLY AND I REALLY NEED THIS TO WORK!!! ALSO PLEASE HAVE THE CODE PROPERLY INDENTED, WITH WHATEVER VARIABLES DEFINED, WHATEVER IT TAKES TO WORK FOR PYTHON 2.7.14. I feel like nothing I do is working and I'm trying everything I can think of. ): In this assignment, the student will create a Python script that implements a series of...
I wrote a program which computes the area and perimeter of a square, circle, or rectangle. As you will see in my main function, there is a for loop in which the user is supposed to be able repeat the program until they enter "q" to quit. However, my program runs through one time, the prompt appears again, but then it terminates before the user is allowed to respond to the prompt again. I'm not able to debug why this...
in C++ use Inheritance for the following Shape Circle Sphere Cylinder Rectangle Square Cube You must define one class for each shape. And, use public inheritance when deriving from base classes. Circle int r; void area(); void perimeter(); void volume(); //No volume for circle Sphere int r; void area();//Sphere surface area= 4 × pi × radius2 void perimeter(); //No perimeter for Sphere void volume();//Sphere volume= 4/3 × pi × radius2 Cylinder int r, height; void area();// Cylinder surface area=perimeter of...
Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly. please put comment with code! and please do not just copy other solutions. Instructions 1. Read instructions carefully! 2. Use C++ syntax only, C syntax will not be accepted. 3. Always use braces to define blocks. 4. Indent all lines within a block. Each block requires one more tab. 5. Organize your code well with proper formatting and a single...
FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...
please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...
Game Description: Most of you have played a very interesting game “Snake” on your old Nokia phones (Black & White). Now it is your time to create it with more interesting colors and features. When the game is started a snake is controlled by up, down, left and right keys to eat food which appears on random locations. By eating food snake’s length increases one unit and player’s score increases by 5 points. Food disappears after 15 seconds and appears...