Question:Since time immemorial, the citizens of Mongna and Negland have been at war. Now, they have finally signed a truce. They have decided to participate in a tandem bicycle ride to celebrate the truce. There are N citizens from each country. They must be assigned to...
Posted at 18:04h
in
Uncategorized
by admin
Question 1:The hailstone sequence starting at a positive integer n is generated by following two simple rules. If n is even, the next number in the sequence is n/2. If n is odd, the next number in the sequence is 3*n+1. Repeating this process, we generate the hailstone sequence. Write a recursive function hailstone(n) which prints the...
Question:
Define a class called Lunch. Its __init__() method should have two arguments: self and menu. Where menu is a string. Add a method called menu_price. It will involve a if statement:
– if “menu 1” print(“Your choice:”, menu, “Price 12.00”)
– if “menu 2” print(“Your...
Posted at 15:11h
in
Uncategorized
by admin
Question 1.
Write a program to print a multiplication table (a times table). At the start, it should ask the user which table to print. The output should look something like this:
Sample Input:
Which multiplication table would you like? 5
Sample Output:
Here’s your table:
5 x 1 = 5
5 x 2...
Problem Description
Trick E. Dingo is trying, as usual, to catch his nemesis the Street Sprinter. His past attempts using magnets, traps and explosives have failed miserably, so he’s catching his breath to gather observational data and learn more about how fast Street Sprinter is.
Trick E....
Posted at 02:07h
in
Uncategorized
by admin
Question:
Anna and Jack are playing a game.
Each player starts with 100 points. The game uses standard six-sided dice and is played in rounds. During one round, each player rolls one die. The player with the lower roll loses the number of points shown on the higher...