Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Code Questions 20. Write code that reads in 3 words one at a time, then creates a list containing all 3 words. 21.


Write Code Questions 20. Write code that reads in 3 words one at a time, then creates a list containing all 3 words. 21. Write a program that reads in an integer from the user and then outputs whether that value is odd or even. 22. Rewrite the following code fragment without a nested if-else statement. The new code should not have a nested if statement, but should only include one if-else statement using logical and relational operators. Your new code should be shorter, clearer, and easier to read but functionally perform the same as the original code. 1a #some value 2 b #some value 3 4 if a 0: print ("Error, both a and b must be non-negative") 6 else: 34567890 10 if b < 0: print ("Error, both a and b must be non-negative") else: print("Please proceed.") 23. Write a program that takes 3 floating point values from the user and creates a list. After the list creation, this program should then ask the user whether they wish to add or delete a value. Based on the response from the user, implement the appropriate code to add or delete a specific value provided by the user. Finally before the program terminates, output the list to the user. 24. Write a program that takes 3 floating point values from the user. Without creating a list or otherwise grouped data type, output the 3 values in descending order.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Code for Question 20 python words for i in range3 word inputEnter a word wordsappendword printList o... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Algorithms

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

3rd edition

978-0262033848

More Books

Students also viewed these Programming questions

Question

If F(x) = f(3f(4f (x))), where f(0) = 0 and f'(0) = 2, find F'(0).

Answered: 1 week ago

Question

What is an access control list?

Answered: 1 week ago

Question

h. What advantages and disadvantages were there to coleadership?

Answered: 1 week ago