Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3 Buster the Troll wants to go visit his friend, the troll king, in Troll Kingdom. He wants to bring some precious stones for
Question 3 Buster the Troll wants to go visit his friend, the troll king, in Troll Kingdom. He wants to bring some precious stones for his friend and he knows that on the way from his troll cave to the kingdom, he will have to pass through a number of troll mountains where he can find the three precious stones (Trollolite,Trollokite and Trollozite) that he wants to collect and give as a gift. He knows that he can carry only 65 pounds (lbs) of stones in his bag. Each stone can weigh from 2 to 7lbs (inclusive). He also wants to keep track of how many stones of each type he has picked. When Buster's bag gets full with 65lbs, or close to 65lbs without going over, he continues on his journey without stopping for more stones. Note: In this simulation of Buster's journey, use a random integer from 13 to identify and count the type of stones that the troll picks, and another random integer from 2 to 7 for the weight of the stone. Write a Python program, in a file called troll_trip.py, to show the type of each stone that Buster puts in his bag (including its weight) and to count and output the total number of each type of stone that Buster gets for his friend. In addition, print the final total weight of the stones (must be no more than 65lbs ). Sample output: Trollolite stone weighing 7 lbs. Trollolite stone weighing 2 lbs. Trollokite stone weighing 4 lbs. Trollozite stone weighing 4 lbs. Trollozite stone weighing 7 lbs. Trollolite stone weighing 2 lbs. Trollokite stone weighing 6 lbs. Trollozite stone weighing 6 lbs. Trollozite stone weighing 6 lbs. Trollokite stone weighing 6 lbs. Trollokite stone weighing 4 lbs. Trollolite stone weighing 2 lbs. Trollozite stone weighing 5 lbs. The number of TROLLOLITE stones in the bag are: 4 The number of TROLLOKITE stones in the bag are: 4 The number of TROLLOZITE stones in the bag are: 5 The total weight of stones in the bag is 61 lbs
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started