Question

Suppose you are a bike shop owner who put together bikes free spare parts. Your customers come to you with parts theyve legi (Python)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Testcases to test the following program:

1 > number_of_wheels = 4
number_of_frames = 4
number_of_links = 100
Expected Ans: Number of bikes coming is: 2
Leftover:
0 wheels
2 frames
0 links

2 > number_of_wheels = 0
number_of_frames = 2
number_of_links = 50
Expected Ans: Number of bikes coming is: 0
Leftover:
0 wheels
2 frames
50 links

2 > number_of_wheels = 6
number_of_frames = 6
number_of_links = 250
Expected Ans: Number of bikes coming is: 3
Leftover:
0 wheels
3 frames
100 links

Following is the program to test the requirement:

number_of_wheels = input("How many wheels do you have?\n")
number_of_frames = input("How many frames do you have? \n")
number_of_links = input("How many links do you have? \n")

def number_of_bikes(number_of_wheels,number_of_frames,number_of_links):
bikes = 0
while(number_of_wheels>=2 and number_of_frames>=1 and number_of_links>=50):
bikes = bikes + 1
  number_of_wheels = number_of_wheels - 2
  number_of_frames = number_of_frames - 1
  number_of_links = number_of_links - 50
print("Number of bikes coming is: "+str(bikes)+"\nLeftover:\n"
+str(number_of_wheels) + " wheels\n" +str(number_of_frames)
+ " frames\n"+ str(number_of_links) + " links\n")

number_of_bikes(int(number_of_wheels),int(number_of_frames),int(number_of_links))

Add a comment
Know the answer?
Add Answer to:
(Python) Suppose you are a bike shop owner who put together bikes free spare parts. Your...
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
  • Write a python program that runs only on the command-line prompt. i.e. if you run this...

    Write a python program that runs only on the command-line prompt. i.e. if you run this program on IDEL it would give you an error message. Name the program “buy.py.” Assume that this program is used by a departmental store to calculate your total price if you want to buy an extended warranty for your purchased Computer. The program takes two arguments at the command-line prompt: 1) the computer’s brand name, and 2) the price of the computer that you...

  • Write this program using python. In your program, when you prompt users for values, only prompt...

    Write this program using python. In your program, when you prompt users for values, only prompt them to enter one value at a time. Here is a sample of what your program should look like. Sample Program Run (User input in bold) What is the length of the room (in feet)? 50 What is the width of the room (in feet)? 30 What is the length of the table (in feet)? 8 What is the width of the table (in...

  • python language Problem Description: In this program we are going to explore a list or an...

    python language Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...

  • Part 3: Arrows Write a python program that prompts the user for a number of columns,...

    Part 3: Arrows Write a python program that prompts the user for a number of columns, and them prints the pattern as seen below. You cannot assume that the user will supply positive numbers - if they misbehave you should re-prompt them until they do give you a positive number. Note that your program only has to run one time, but multiple runnings of the program are shown below: How many columns? 3 * * * * * How many...

  • IN PYTHON Up until now, we have learned about printing text to the screen, functions, parameters,...

    IN PYTHON Up until now, we have learned about printing text to the screen, functions, parameters, loops, how to get input from users, text processing, and how to use if/else statements to have different execution paths. Everything we need in order to make our first game! For this assignment write a text-adventure game. Your game must have the following: at least 4 choices the player must make a different outcome for each of the 4 choices For extra points, draw...

  • This problem demonstrates the use of import module. The Python programming language has many strengths, but...

    This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...

  • Write a program that asks the user how many integers they would like to enter. You...

    Write a program that asks the user how many integers they would like to enter. You can assume they will enter an integer >= 1. The program will then prompt the user to enter that many integers. After all the numbers have been entered, the program should display the largest and smallest of those numbers (no, you cannot use lists, or any other material we haven't covered). When you run your program it should match the following format: How many...

  • PYTHON CODE DOCUMENT EVERY LINE * You cannot use any external Python libraries. You can, of...

    PYTHON CODE DOCUMENT EVERY LINE * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work is the same as...

  • Please help: For this project, you will create a shape drawing program using Turtle graphics. Your...

    Please help: For this project, you will create a shape drawing program using Turtle graphics. Your program will begin by asking the user how many points they would like to enter (# of vertices for the shape). Next, you will use a loop to input each X and Y coordinate and store these coordinates in lists. After inputting all of the coordinates, create a second loop that will draw and fill the shape using the coordinates that were entered. All...

  • In this assignment you are asked to write a Python program to determine all the prime...

    In this assignment you are asked to write a Python program to determine all the prime numbers in between a range and store them in a list that will be printed when the range is searched. The user is prompted for two positive integer values as input, one is the start of the range and the other is the end of the range. If the user gives a negative value or enters a second number that is lower than the...

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