+1(316)4441378

+44-141-628-6690

Beginner’s Python

Part 1:
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

Sample input/output:
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
You Win!

Part 2:
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.
Sample input/output:
Conversion Menu:

1. Convert feet to inches
2. Convert yards to feet
3. Convert miles to yards
4. Convert miles to feet
5. Exit

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
Goodbye.

Part 3
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):

red
blue
green

3
2

Part 4:
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.
Sample output:
[74, 19, 20, 67, 77, 38]
Total: 295
Average: 49.167

 

You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.

 

Latest completed orders:

# topic title discipline academic level pages delivered
6
Writer's choice
Business
University
2
1 hour 32 min
7
Wise Approach to
Philosophy
College
2
2 hours 19 min
8
1980's and 1990
History
College
3
2 hours 20 min
9
pick the best topic
Finance
School
2
2 hours 27 min
10
finance for leisure
Finance
University
12
2 hours 36 min
[order_calculator]