Author: admin
Home > Articles posted by admin (Page 65)
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...
Question:
Eric works in a door mat manufacturing company. One day, he designed a new door mat with the
following specifications:
◦ Mat size must be A x B. (A is an odd natural number, and B is 3 times A.)
◦ The design should have ‘WELCOME’ written in...
Posted at 02:48h
in
Uncategorized
by admin
You could do the following homework using IDLE
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...
Posted at 16:20h
in
Uncategorized
by admin
Question:
A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split in four sub quadrants, etc. In the quadtree, the image is represented by...
Question:
A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split in four sub quadrants, etc. In the quadtree, the image is represented by...