Write a python function that takes a list of integers

Assignment Help Programming Languages
Reference no: EM133818995

Introduction to Programming

Purpose of the assessment : This assignment evaluates student's understanding of basic programming principles using Python programming language. In particular, it assesses student's ability to develop algorithms, problem solve, running scripts and write meaningful comments, while being an active member of a team.

Question 1
Save your file for this program as findDuplicates.py

Write a Python function (called findDuplicates()) that takes a list of integers as input and returns a list containing all the duplicate elements from the input list. If there are no duplicates, the function should return an empty list.

For example,

Start by writing an algorithm for solving the problem (i.e. set of steps to the problem). Copy both the algorithm and your script to the answer sheet. You must submit both, your answer sheet and .py file(s).

Question 2
Save your file for this program as maxiLyst.py

Define a function (call it maxiLyst()). maxiLyst takes two arguments: a list of digits D and an integer M. The function returns a list. The function iterates through the first M digits of D, finds the largest number within that set, and appends it to the result list. Then, it shifts one position at a time and repeats the process until the end of the list D. Hire Writer Now!

For example,

Start by writing an algorithm for solving the problem (i.e. set of steps to the problem). Copy both the algorithm and your script to the answer sheet. You must submit both, your answer sheet and .py file(s).

Question 3
Save your file for this program as prime.py

Write a Python function named "prime()" that identifies prime years within a given range of years. The function should prompt the user to input a range of years and then print out which years within that range are prime and which are not. A prime year is defined as a year that is divisible by 4. However, if the year is divisible by 4 and also divisible by 100, then it is not considered prime unless it can be evenly divided by 400. For instance, the function should correctly identify that 2000 and 2004 are prime years, while 1900 and 2100 are not prime years.

For example,

Start by writing an algorithm for solving the problem (i.e. set of steps to the problem). Copy both the algorithm and your script to the answer sheet. You must submit both, your answer sheet and .py file(s).

Question 4
Save your file for this program as gamify.py

Write a Python function (call it gamify()), which implements a number manipulation game.
In this game, the program prompts the user to input an integer number. If the number is even, it is divided by 2. If the number is odd, it is multiplied by 3 and 1 is added to the result. This process is repeated until the number reaches 1. The program then prints each number generated during the process, separated by spaces.

For example,
Given the numbers 24, 176, 21, and 1024, the output would be as follows:

Start by writing an algorithm for solving the problem (i.e. set of steps to the problem). Copy both the algorithm and your script to the answer sheet. You must submit both, your answer sheet and .py file(s).

Reference no: EM133818995

Questions Cloud

Identify two statistical terms used within this article : Identify at least two statistical terms used within this article and provide definitions. Include the article on your reference page.
Identify common examples of why flow control is needed : Identify common examples of why flow control is needed and how it ensures reliable data transfer between senders and receivers. Provide 2-3 references.
How to deal with employees from different culture background : Discuss the role of cultural values and attitudes when determining how to deal with employees from different cultures or ethnic backgrounds.
What fees are charged to operate the casino : What fees are charged to operate the casino? What is the gaming tax percentage per each type of casino game? How are gaming taxes distributed to state funds?
Write a python function that takes a list of integers : HS1031 Introduction to Programming - Write a Python function (called findDuplicates()) that takes a list of integers as input and returns a list containing
What three factors determine the power of a statistical test : PSY 321- What is the difference between Type I and Type II errors? What three factors determine the power of a statistical test?
Identify and discuss the strengths of the software : Identify and discuss the strengths of the software. Consider usability, interface design, functionality, and any features that worked exceptionally well
Describe political economic and cultural factors you see : Describe political, economic, and cultural factors you see as prohibiting world leaders from agreeing on solutions to global environmental challenges.
Summarize the mission or philosophy statement : Summarize the mission or philosophy statement for each of the health care delivery systems you selected.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd