Write a program that asks the user for a secret number between one and ten. This will become the number that the player tries to “guess”.
Ask the user player to guess a number between 1 and 10.
If the user’s guess is higher than the secret number, the program should display “Too high. Try again.”
If the user’s guess is lower than the random number, the program should display “Too low. Try again.”
The program should use a loop that repeats until the user correctly guesses the secret number.
Then the program should display “You Win!”
TIP: Use a while loop
Enter the secret number: 7
Guess a number between 1 and 10: 3
Too low. Try again.
Guess a number between 1 and 10: 9
Too high. Try again.
Guess a number between 1 and 10: 7
Write a program that converts the common measurements below. Use functions to logically organize each conversion task below. Each of the conversion functions should return the result. The conversion functions should not print the result.
Convert feet to inches. (1 foot = 12 inches)
Convert yards to feet. (1 yards = 3 foot)
Convert miles to yards. (1 mile = 1760 yards)
Convert miles to feet. (1 mile = 5280 feet)
Print the output of the conversion to the screen.
Display a menu that asks the user to select from the above options and with the option to exit the program.
After the user selects a menu option and the output is printed, ask the user for another menu option. This process repeats until the user selects 5 to exit.
1. Convert feet to inches
2. Convert yards to feet
3. Convert miles to yards
4. Convert miles to feet
Please choose a menu option: 1
Enter the number of feet: 3
There are 36 inches in 3 feet.
Please choose a menu option: 5
Create a list of something that you choose, such as a list of scores, colors, movies, general numbers, etc. Call the list you create: my_list
Iterate over the list, printing each item in the list.
Add a new item to the list.
Print the length of the list.
Delete an item from the list.
Print the length of the list again.
Sample output (the output is shown below but not all coding steps above have output):
You have a list called: numbers = [74, 19, 105, 20, -2, 67, 77, 124, -45, 38]
Design a program that uses a loop to build another list named valid_numbers .
This valid_numbers list will contain some of the numbers from the numbers list shown above. If a number in the numbers list is between 0 and 100, you will add that number to the valid_numbers list.
Is the first number in the numbers list between 0 and 100? If so, add it to the valid_numbers list.
Is the second number in the numbers list between 0 and 100? If so, add it to the valid numbers list.
Keep going. The numbers list could be of any size and contain any number, so don’t assume a certain list content or length.
The program should then print the valid_numbers list.
The program should also print the total and average of the values in the valid_numbers list.
TIP: Average is the sum divided by the number of items. Iterate over the valid_numbers, sum all the numbers, and calculate the average.
TIP: You are not expected to research Python topics we haven’t discussed in class. Just use what we’ve learned in class.
You MUST use a loop. You MUST use a list. You MUST follow the directions above.
[74, 19, 20, 67, 77, 38]
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code “Newclient”
The post Beginner’s Python appeared first on Savvy Essay Writers.
Beginner’s Python was first posted on July 4, 2020 at 8:43 am.
©2020 “Savvy Essay Writers”. Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at email@example.com