Question: Basic Python Programming 3 test runs for each question Use Control Statements (if and loops) that's it 4.Write a program to take single character input
Basic Python Programming
3 test runs for each question
Use Control Statements (if and loops) that's it
4.Write a program to take single character input from the user and then check whether it is a number or a character. If it is a character, determine whether it is in uppercase or lowercase. If it is a number display A number was entered. The digits '0' to '9' are characters.
Sample Run 1
>>>
Enter any character : C
Uppercase character was entered
Sample Run 2
>>>
Enter any character : b
Lowercase character was entered
Sample Run 3
>>>
Enter any character : 2
A number was entered
5.Write a program to print the number of horizontal asterisks * .
User input an int number. (use while loop only)
Sample Run
>>>
How many stars do you want? 20
6.Write a program to calculate the property tax. User enters the lot number and property value. Use while loop keep entering lot and calculate value until user enters a sentinel of -999 to end program. Tax factor is 0.0065. Property tax = property value X tax factor
Sample Run
>>>
Enter the property lot number or enter -999 to end
Enter the lot number : 100
Enter property value : 100000.00
Property tax : $650.00
Enter the property lot number or enter -999 to end
Enter the lot number : 200
Enter property value : 5000.00
Property tax : $32.50
Enter the property lot number or enter -999 to end
Enter the lot number : -999
7. Write a program using while loop with validation where user input wholesale prices to calculate retail prices. The markup is 2.5 times. Validation is to check if a value is out of range and display a message to let the user know that the value entered is an error. In this case the wholesale value cannot be less than zero.
Sample Run 1
>>>
Enter the items wholesale cost: -.50
ERROR: the cost cannot be negative
Enter the correct wholesale cost: .50
Retail price is $1.25
Do you have another item?
(Enter y for yes): n
Sample Run 2
Enter the items wholesale cost: .75
Retail price is $1.88
Do you have another item?
(Enter y for yes): Y
Enter the correct wholesale cost: .50
Retail price is $1.25
Do you have another item?
(Enter y for yes): n
8.Write a for loop using range() function to print Barzinger 5 times.
Barzinger
Barzinger
Barzinger
Barzinger
Barzinger
(one test run only for this question)
9.Write a program that uses a for loop to calculate the sum of numbers. The user will specify how many numbers to sum.
Sample Run
>>>
How many numbers do you want to add? 3
Enter number 1 : 25
Enter number 2 : 34
Enter number 3 : 33
The total is 92.0
10.Write a program using for loop to convert speeds from 60kph through 130kph (in 10 kph increments) to mph. The formula: mph = kph * conversion factor where conversion factor is 0.6214. (one test run only for this question)
Sample Run
>>>
KPH MPH
------------------------------------
60 37.3
70 43.5
80 49.7
90 55.9
100 62.1
110 68.3
120 74.6
130 80.8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
