Aurora Saturday 14:30
Home > Aurora Saturday 14:30 (Page 14)
Question:
You are given a string . Suppose a character ‘a’ occurs consecutively n times in the string. Replace these consecutive occurrences of the character ‘a’ with (n, ‘a’) in the string.
Input Format: A single line of input consisting of the string .
Output Format: A single line of...
Question:
Modify the program we made in the class. Add starting screen as below, the real game will start when play click the mouse in the range of the "PLAY" button. (Scroll down for more hint)
You can download the background images from below:
The size of the...
Question:
Modify the program we made in the class to:
Create Missile class
Add one missile to your program
missile will automatically move from your spaceship to the top of the screen
once missile reach the top of the screen, it will re-appear from the location of your fighter
Hint:
speed has...
Question:
Write a function luckySum(a, b, c) to calculate sum of given 3 int values, a b c. The function will have a return value of their sum. However, if one of the values is 13 then it does not count towards the sum and values to its...
Question:
Draw the following picture in the pygame window: (could be different color)
Hint: using pygame.draw.circle
...
Question:
Create a PWD(Password) class it will contain the following methods:
__init__
to create a password object by passing one argument into it
validate
to check the validity of password input by users. it need to use the following method:
checkLetter: At least 1 letter between [a-z] and 1 letter between[A-Z].
checkNumber:...
Question:
Create an object WordReverse to reverse a string.
You need one argument (which is the original string) to create the object.
def __init__(self, word):
You need one method to reverse the string
def reverse(self):
You can print the object with the following expected output...
Question 1:
Create a Tank object which have the attributes of:
name
direction(up/down/left/right)
x position and
y position
The object also have a method:
move (direction, steps)
Using __init__ to Initial the tank to make sure it start from x position of 0 and y position of 0
Use print(tank...
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:(please use function that return a value)
Write a program to display information to a driver based on his/her speed according to the following table:
km/h over the limit
Fine
1 to 20
$100
21 to 30
$270
31 or above
$500
Sample Input 1:
Enter the speed limit: 40
Enter the recorded speed of the...