# Q1:Write a program in python to calculate how many years does it ta...

## Question

Q1:Write a program in python to calculate how many years does it take for you to trash your car, if you start your car value of 20000 and each year you pay 5% of your car value (i.e., 20000*5%) to repair your car. Hint, we assume if the car value is less than the repair fee, you should trash your car.

Q2: Write a program in python for an elementary student to help me practice arithmetic addition.
1. random generate two numbers from 0 to 100, named as a and b
2. calculate a+b and save as correct.
3. catch the starting time
4. ask a user to input their result and save as answer.
5. catch the ending time
6. while the answer is not correct or the calculation time is longer than 10 seconds, show the correct answer and then repeat 1-5.
7. print on the console "You are good!"

Q3: Write a program in python that asks users to enter their name and age. While their name is not "Nobody", the program displays an information box showing users’ name and age on the information box

Q4: Write a Python function printGreetings to print out "Hello" and "Goodbye" for all 100 students using "while" statement. The output is as follows:
Hello, Student1!
Goodbye, Student1!
Hello, Student2
! Goodbye, Student2!
Hello, Student3!
Goodbye, Student3!
...
Hello, Student98!
Goodbye, Student98!
Hello, Student99!
Goodbye, Student99
! Hello, Student100!
Goodbye, Student100!

Q5: Ask the user to enter the value of the expression   8 + 7 * 5 / 2 - 6.
To allow them to enter floats, we will use requestNumber() as opposed to requestInteger() for the user's answer.
In order to make the prompt more readable, we should split it into two lines in the requestNumber() dialog box. We use the character sequence \n to insert a carriage return in a string, e.g., "What is the value of the Python expression \n 8 + 7 * 5 / 2 - 6 ?"
Calculate the correct response and store it as the variable correct.
Check the user's response using while loop such that:
while the user's response is not the correct answer
If the user's response is less than the correct answer, print "Too low!" to the console. It does not matter at this point if they entered 5 or 5.5, for example--just that it's less than the correct answer.
Else, if the user's response is greater than the correct answer and not equal to incorrect, print "Too high!" to the console.
Else, if the user’s response is incorrect, print “incorrect!”
Ask users calculate it again!
If the user's response is equal to the correct answer, print "Correct!" to the console.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

"""
Q1: Write a program in python to calculate how many years does it take for you
to trash your car, if you start your car value of 20000 and each year you pay
5% of your car value (i.e., 20000*5%) to repair your car. Hint, we assume if
the car value is less than the repair fee, you should trash your car.
"""
def main():
fee = 0
year = 0
while fee <= 20000:
year += 1
fee += 20000*0.05
print "Years to trash your car is: " + str(year) + " years."

main()...

By purchasing this solution you'll be able to access the following files:
Solution1.py, Solution2.py, Solution3.py, Solution4.py and Solution5.py.

\$48.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.