Python Homework – Write an algorithm for a program that calculates and displays the volume, surface area, and radius of the base of a cylinder. Determine the required input data, steps to solve the program, and output(s)

• # Step 1: Prompt the user to enter the height (h) and radius (r) of the cylinder
print(“Enter the height and radius of the cylinder:”)
• # Step 2: Read the input values (h and r) from the user
h = float(input(“Height (h): “))
• # Step 3: Calculate the volume (V) of the cylinder
pi = 3.14159
V = pi * r**2 * h
• # Step 4: Calculate the surface area (A) of the cylinder
A = 2 * pi * r * (r + h)
• # Step 5: Display the calculated volume (V), surface area (A), and the radius (r) of the base
print(“Volume of the cylinder:”, V)
print(“Surface area of the cylinder:”, A)
print(“Radius of the base of the cylinder:”, r)

Part 2 (10pts)

Using the IDLE prompt, write expressions for the following:

1. Create a variable s with the value ‘goodbye’ 1pt
s = ‘goodbye’
2. Display the first character of s 1pt
print(s[0]) # Output: ‘g’
3. Write Boolean expressions for the following:
1. The first two characters of s are ‘g’ and ‘a’ 1pt
2. first_two_characters_match = s[0] == ‘g’ and s[1] == ‘a’
3. The next to last character of s is ‘b’ 1pt
4. next_to_last_character_is_b = s[-2] == ‘b’
5. The first character of s is ‘g’ 1pt
first_character_is_g = s[0] == ‘g’
4. Write Python expressions corresponding to these statements:
1. The number of characters in the word “anachronistically” is 1 more than the number of characters in the word “counterintuitive”. 1pts
2. num_characters_anachronistically = len(‘anachronistically’)
num_characters_counterintuitive = len(‘counterintuitive’)
one_more = num_characters_anachronistically == num_characters_counterintuitive + 1
3. The word “misinterpretation” appears earlier in the dictionary than the word “misrepresentation” 1pts
4. is_earlier = ‘misinterpretation’ < ‘misrepresentation’
5. The number of characters in the word “counterrevolution” is equal to the sum of the number of characters in the words “counter” and “resolution” 1pts
6. num_characters_counterrevolution = len(‘counterrevolution’)
num_characters_counter = len(‘counter’)
num_characters_resolution = len(‘resolution’)
sum_equal = num_characters_counterrevolution == num_characters_counter + num_characters_resolution
7. The sum of 17 and -9 is less than 10 1pt
8. sum_less_than_10 = 17 + (-9) < 10
9. The length of “inventory” is more than five times the length of “full name” 1pts
10. length_inventory = len(‘inventory’)
length_full_name = len(‘full name’)
more_than_five_times = length_inventory > 5 * length_full_name

For your homework solution, submit a word document. Use the following naming convention for your homework file: homework1_firstInitial_lastName.docx.

The first part of your file will contain Part 1 solution. For Part 2, copy or take a screen shot of each expression and paste it under the related problem number or letter.

.Get Python homework help today