Posted at 03:10h
in
Uncategorized
by admin
Question 1:
Ask the user for two numbers and then print the addition, subtraction, division(quotient), multiplication and the remainder(the number left when the first number is divided by the second number)
Sample Execution in shell
-------------------------------------------------
>>> Enter first number: 20
>>> Enter second number: 8
>>> Addition is 28
>>> Subtraction...
Question:
Write code to find the nth smallest number in the array using the
algorithm we learnt for quick sort.
Input
7,8,9,12,15,19,2,1 (Array)
3 (N)
Output
7
Explanation:
7 is the 3rd smallest number in the array...
Posted at 22:57h
in
Uncategorized
by admin
Question:
Create a Tank class which have the attributes of:
name
direction(use ‘up’, ‘down’, ‘left’ or ‘right’)
x position and
y position
The class also have the following method:
move (self, direction, steps)
Using __init__() to Initial the tank to make sure it start from x position of 0, y...
Posted at 03:05h
in
Uncategorized
by admin
Question:
Write a code to print the number of enemies killed by the player
and print the number after the player dies
The link to the code from the previous class is
https://paste.ubuntu.com/p/hyBsnmw6BG/
Below is the example of the output:
...
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 the new value using print.
Question 3
Make another...
Posted at 17:55h
in
Uncategorized
by admin
Question 1.
Use EasyGui to write a program to convert temperatures from Fahrenheit to Celsius. The formula for that is: Celsius = 5 / 9 * (Fahrenheit – 32). Use GUI input and output. You need to create a easygui enterbox to ask Fahrenheit, then use...