Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

Question
Book Icon
Chapter 11, Problem 5PE
Program Plan Intro

Python functions

Program plan:

  • Define the function “count(myList,x)”,
    • Returns the count of the given “x” value.
  • Define the function “isin(myList,x)”,
    • Returns “True”, if the value “x” is present in the list.
  • Define the function “index(myList,x)”,
    • Returns the index or position of the given “x” value.
  • Define the function “reverse(myList)”,
    • Return a new list consists of the elements which are reversed.
  • Define the function “sort(myList)”,
    • Return a new list consists of the elements which are sorted.
  • Define the function “main()”,
    • Create a list “myList” with the elements.
    • Assign the value of “x”.
    • Print the value return from “count(myList,x)”.
    • Print the value return from “isin(myList,x)”.
    • Print the value return from “index(myList,x)”.
    • Print the value return from “reverse(myList)”.
    • Print the value return from “sort(myList)”.
  • Call the “main()” function.

Blurred answer
Students have asked these similar questions
Write a Python recursive sum function that can sum the content of a list, tuple, set, and dictionary. Do no use any built-in function!!!! thank you, IN PYTHON!!!
the language is C++, please take a screenshot of your output. (Recursive binary search) The binary search algorithm given in this chapter is nonrecursive. Write and implement a recursive version of the binary search algorithm. Also, write a version of the sequential search algorithm that can be applied to sorted lists. Add this operation to the class orderedArrayListType for array-based lists. Moreover, write a test program to test your algorithm.
Write a function in a racket code that takes as input a list of elements and returns a list with elements and their position after. For example, if the input to the function is (list ’a ’b ’c) then it will return (list a 1 b 2 c 3). Make sure to use recursion
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education