Posted at 01:54h
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:
...
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...
Posted at 01:50h
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:
...
Posted at 21:45h
in
Uncategorized
by admin
Question:
Alice is looking at a crystal through a microscope. Alice’s microscope has the interesting feature that it can superimpose grid lines over the image that she is looking at.
At level 1 of magnification, Alice sees the image as follows:
Notice that at level 1, there is...
Question:
A provincial government is going to build roads to connect of any two towns in the province(but not necessarily directly connected by road, as long as it can be reached indirectly by road). They have the table lists the distance between any two towns. The...
Question:
Alice took a clean sheet of paper and drew h horizontal and v vertical lines onto the paper.
The horizontal lines have y-coordinates y1,…,yh, and the vertical lines have x-coordinates x1,…,xv.
Given these coordinates, count the number of squares that appeared on the paper.
(The whole boundary of the square has to be drawn. The inside...