Posted at 01:04h
in
Uncategorized
by admin
Question 1:
Factorial of any number n is represented by n! and is equal to 1*2*3*….*(n-1)*n. for example:
4! = 1*2*3*4 = 24
3! = 3*2*1 = 6
2! = 2*1 = 2
Also,
1! = 1
0! = 1
Write a program to calculate factorial of a given number.
Question 2:
Create a loop...
Posted at 00:51h
in
Uncategorized
by admin
Question 1:Modify the Dice class we made in the last class, so it could compare with different dies using ==. In order to complete this task, you need to overwrite __eq__.
Question 2:Create Card class so it can complete the following tasks:
Card() - You can initial...
Posted at 02:01h
in
Uncategorized
by admin
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...
Question:
Write code to do absolute sort with the following condition
Sort an array according to its absolute value. Please refer to this link https://en.wikipedia.org/wiki/Absolute_value if you don’t know what absolute value is
If the array for a specific number contains both its negative form and...
Question:
Continue with the code in the previous class, make sure when the circle moves out of the screen from the left side, it appears again from the right side. Similarly if the circle moves out from the top, it appears again from the bottom. Please...
Posted at 00:25h
in
Uncategorized
by admin
Question:
Continuing with the code in the previous class we added the bullets to the game but the bullets are not moving towards the top.
Modify the update function inside the Missile class so that the missile moves towards the top when we hit the space key
The...