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 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...

  • 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...

  • 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...

  • Code In Python Well Document Code Every Line Please * You cannot use any external Python...

    Code In Python Well Document Code Every Line Please * 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...

  • Code In Python Well Document Code Every Line Please * You cannot use any external Python...

    Code In Python Well Document Code Every Line Please * 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...

  • PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem...

    PLease help!!! how to type them in Python !!!! Python help!! THank you so much Problem 1: (20 points) Optimal change You will write a program that uses the // and % operators to figure out how to give change for a specified amount using the minimum number of coins (quarters, dimes, nickels, cents). The good news is that our currency is specifically designed to make this problem easy. For a given number of cents, first use as many quarters...

  • It's time to put everything you've learned together and do something fun with Python! Be creative,...

    It's time to put everything you've learned together and do something fun with Python! Be creative, do your best, and have fun! Your project will be automatically included in the pool of students' work. If selected, your project will be used as a demonstration to current and prospective students in the future. Please let me know if you prefer NOT to include your project to be in the pool of demonstrating projects. Project Description Create a real-world scenario of a...

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