archives
Home > archives (Page 10)
Posted at 03:50h
in
archives
by admin
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...
Posted at 03:41h
in
archives
by admin
Question 1:
A soccer team is looking for girls from ages 10 to 12 to play on their team. Write a program to ask the user’s age and if male or female (using “m” or “f”). Display a message indicating whether the person is eligible to play on the team.
Sample Input...
Posted at 17:16h
in
archives
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...
Posted at 06:44h
in
archives
by admin
Question:
A store is having a sale. If the customer purchased 10 dollars or more, the store will give $2 off. Please write a program to ask how much the customer has bought. The program will show the discount and the final price the customer has...
Posted at 03:20h
in
archives
by admin
Question :
In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n:
n!=n*(n-1)*(n-2)*(n-3)*...
Posted at 19:50h
in
archives
by admin
Question 1:
Write a program to ask the user to enter an ingredient for pizza for 3 times. After entering three ingredients, the program will show the message “We will add …. into your pizza.”.
Sample Input:
Please enter an ingredient for your pizza: mushroom
Please enter an ingredient...
Posted at 16:57h
in
archives
by admin
Question:
The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in meters) and weight (in kilograms), then calculates the BMI using the formula
BMI = weight / (height * height)
Write a program which...
Posted at 20:44h
in
archives
by admin
Question 1:
You are in a bike race which goes up and down a hill. You could create two variables: uphillDistance and downhillDistance give the distance (in km) of both parts of the race. Write a program that will print out the total distance for the...
Posted at 00:06h
in
archives
by admin
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...
Posted at 00:02h
in
archives
by admin
Question 1
Mike, Cindy and Terry went to the orchard to pick apples. After a whole day of work, everyone picked a lot of apples. Please write a program ask how many apples each person has picked, then print the total apples all three of them...