Posted at 04:10h
in
Uncategorized
by admin
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...
Question:Christy C. Coder is traveling to Waterloo for a programming competition. On the way, she stops in Toronto to do some sightseeing. The unfortunate thing about travelling is that everyone back home expects her to bring back pictures of everything. Christy hates taking pictures: it...
Posted at 03:10h
in
Uncategorized
by admin
Question:The general problem of balancing and nesting different kinds of opening and closing symbols occurs frequently. Strings of symbols such as
{ { ( [ ] [ ] ) } ( ) }
[ [ { { ( ( ) ) } } ] ]
[ ] [ ]...
Question:
The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was written correctly.
The 1-3-sum of a 13-digit number is calculated by multiplying the digits alternately by 1’s and 3’s (see example)...
Posted at 07:09h
in
Uncategorized
by admin
Question:Continue modify the program in the last class, if your fighter touches the enemy:
the fighter will explode
the game status will be STATUS_GAMEOVER
when game over, everything will not show on the screen except for the background and planets.
...
Question 1:
A store is having a sale. They’re giving 10 percent off purchases of $10 or lower, and 20 percent off purchases of greater than $10. Write a program that asks the purchase price and displays the discount (10% or 20%) and the final price.
Sample Input...