Question:
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he...
Posted at 20:48h
in
Uncategorized
by admin
Question:
Examine the following function definition. Can you spot any problems with the definition? If so, how can you fix the problems?
function format(ohmage)
{
var result;
if ohmage >= 1e6
{
ohmage = ohmage / 1e6;
result =...
Question:
Input a string. You must using a stack, reverse the string and print it.
Sample Input 1:
Enter String to reverse : Apple
Sample Output 1
elppA
Sample Input 2
Orange
Sample Output 2
eganrO
...
Question:
write a program to ask user about the date(year, month and day), then calculate the day of the year.
Sample input:
Year: 2016
Month: 6
Day: 23
Sample output:
Day of the year: 175
Hint:
You need consider leap years and non leap years, in order to do easier calculation, you may...
Posted at 20:21h
in
Uncategorized
by admin
Question:
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 1:
How...
Posted at 20:17h
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...