Uncategorized
Home > Uncategorized (Page 54)
Posted at 03:09h
in
Uncategorized
by admin
You can do Question 1~ 3 in Python IDLE:
Question 1.
Use float() to create a number from a string like ‘12.34’. Make sure the result is really a number!
Question 2.
Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded up...
Posted at 02:54h
in
Uncategorized
by admin
Question:
Continue with the code from the previous class, create a new sprite called Enemy2 with any color you like. Make sure when the new enemy collide with the player, the enemy should be destroyed...
Posted at 16:34h
in
Uncategorized
by admin
You can do Question 1~ 3 in Python IDLE shell:
Question 1.
Use float() to create a number from a string like ‘12.34’. Make sure the result is really a number!
Question 2.
Try using int() to create an integer from a decimal number like 56.78. Did the answer get rounded...
Posted at 21:40h
in
Uncategorized
by admin
Question:
Change the code in the method updateNumber(self, num) to complete the following task:
if you click 0 and the display is 0, the display will remain 0
if you click any number other than 0 and the display is 0, the display changed into the...
Posted at 21:35h
in
Uncategorized
by admin
Question:
Create an OunceConversion object to convert any number of fluid ounces to the equivalent number of gallons, quarts, pints, and gills. (There are 128 fluid ounces in a gallon. There are 32 fluid ounces in a quart. There are 16 fluid ounces in a pint. There are 4 fluid ounces in a...
Posted at 21:06h
in
Uncategorized
by admin
Question:
A store is having a sale. If the customer purchased 10 dollars or more, the store will give $2 off. Please write a program to ask how much the customer has bought. The program will show the discount and the final price the customer has...
Posted at 20:58h
in
Uncategorized
by admin
Question:You and your friend have come up with a way to send messages back and forth.
Your friend can encode a message to you by writing down a positive integer N and a symbol. You can decode that message by writing out that symbol N times in a row on...
Posted at 03:33h
in
Uncategorized
by admin
Question 1
Make a variable and assign a number to it (any number you like). Then display your variable using print.
Question 2
Modify your variable, either by replacing the old value with a new value, or by adding something to the old value. Display the new value using print.
Question 3
Make another...
Posted at 18:58h
in
Uncategorized
by admin
Question 1
Make a variable and assign a number to it (any number you like). Then display your variable using print.
Question 2
Modify your variable, either by replacing the old value with a new value, or by adding something to the old value. Display the new value using print.
Question 3
Make another...
Posted at 02:48h
in
Uncategorized
by admin
Question:
Make a class definition for a BankAccount. It should have attributes for :
– its name (a string),
– account number (a string or integer),
– and balance (a float).
It should have methods to:
– make deposits with displaying the balance,
– and make withdrawals with displaying the balance.
Hint:
...