Develop algorithmic solutions to programming problems

Assignment Help Programming Languages
Reference no: EM132886073

HS1031 Introduction to Programming - Holmes Institute

Purpose - Assess student's ability to develop algorithmic solutions to programming problems using Python language.

This assignment evaluates your understanding of basic programming principles using Python language. In particular, it assesses your ability to develop algorithms to solve simple problems, successfully run Python programs, and your ability to write meaningful comments when required.

Most of the constructs you may need to solve the problems in this assignment have already been covered in your class. However, you are encouraged to research other programming concepts, such as Python Lists, to help you in solving the problems.

1. Approximate

The mathematical value pie is the ratio of the circumference of a circle to its diameter. Pie is calculated using the following equation:

π/4 = 1 - 1/3 + 1/5 - 1/7 + . . .

Notice that the sign fluctuates from plus to negative and the denominator increases by two in the series. The more iterations implemented, the more accurate the resulting value for Pie.

For example, for an iteration of 3, π = (1 - 1/3 + 1/5)*4= 3.46, while for an iteration of 50, π =
3.12 (which is closer to the actual Pie of 3.141592653589793.

Write a program (save it as approximate.py) which prompts the user to enter the number of iterations and prints out the resulting value of pie on the screen.

Start your answer by stating the algorithm, i.e. steps required to solve the problem. Also make sure to add comments to your code that correspond to the algorithm

2. Truncate

Write a program (save it as truncate.py) which takes an English text as an input and returns the same text, however with the repeated words removed.

For example, for the following text:

If the input message is: "Every person had a star, every star had a friend, and for every person carrying a star there was someone else who reflected it, and everyone carried this reflection like a secret confidante in the heart.

The output message would be: "every person had a star friend and for carrying there was someone else who reflected it everyone carried this reflection like secret confidante in the heart".

Start your answer by stating the algorithm, i.e. steps required to solve the problem. Also make sure to add comments to your code that correspond to the algorithm.

3. Lucky

Develop a game (save it as lucky.py). This game is played by two players. At each round, each player presents either a (1) Rock, (2) Paper or (3) Scissor using their hand gestures:

A Rock (1) wins over Scissors (3) A Paper (2) wins over Rock (1) Scissors (3) win over Paper (2)

Design this game such that the first Player can be you (the user), while the second Player is (the computer). The computer generates a random choice at each round. After each round, a message is printed on the screen declaring the winner. The following rules apply:

• The user enters (1) for Rock, (2) for Paper or (3) for Scissors.
• Whoever wins the round gets one point.
• The game terminates when the user hits enter without making a choice.
• By the end of the game a message is printed on the screen declaring the winner and how many points they accumulated throughout the game.

Attachment:- Introduction to Programming.rar

Reference no: EM132886073

Questions Cloud

Examine the professional nursing roles of care manager : Examine the professional nursing roles of care manager, educator, researcher, and advocate in relation to pharmacologic therapy and within the framework
The globalization of health : Post a brief summary on the effects of globalization on health in Russia. Discuss one change in quality of life in post-transition Russia.
How does ipratropium mdi work : How does ipratropium MDI work? Make sure to include the drug category, mechanism of action, onset and duration of action, and safety considerations.
How much overhead should be applied to job : Question - The predetermined overhead rate is P12.00 per direct labor hour. How much overhead should be applied to Job
Develop algorithmic solutions to programming problems : Develop algorithmic solutions to programming problems using Python language - Design this game such that the first Player can be you (the user)
Basic employee right to file a complaint with osha : An employee comes to your office and says he wants to anonymously make a complaint to the US Occupational Safety and Health Act. He doesn't want his identity kn
How much cash should Athena invest : Athena and Eve agree to form a partnership on May 1. If the partners agree that equity will be 40% for Eve and 60% for Athena, how much cash Athena invest
What industry to target with microfinance : What industry (or industries) to target with microfinance or any other governmental small business assistance programs.
Discuss components of executive compensation package : Describe what elements/components are typically include in Executive Compensation Packages. Evidence indicates that Senior Managers typically make more money pe

Reviews

Write a Review

Programming Languages Questions & Answers

  Retrieve records from database

Which fields have interests shared by academics from the same department?

  Write a function that accepts an array and a value

Write a function that returns a string containing random characters where the length must be equal to the value of the parameter

  What programming language is the csci project written in

The CSCI and CINS students enrolled in the senior capstone project course (CSCI/CINS 490) will be presenting posters of projects each student has been working on this semester. You are to learn about three of these projects and do a writeup of ea..

  Unit 20 Advanced Programming Assignment

Unit 20 Advanced Programming Assignment Help and Solution, BTEC Higher National Diploma in Computing - Assessment Writing Service

  Creating a program that writes to a data file

Creating a program that writes to a data file called Celtofarendfile.txt using the end of file structure. The program should create a conversion table of Celsius to Fahrenheit from 0 to 100 Celsius in increments of 5.

  Write a program to output accumulated values for each month

Write a program to output accumulated values for each month, given a set amount saved each month, until the accumulated amount reaches a set goal amount.

  Smallest number using class-friend function and overloading

C++program which can neither be two integers or two floating point number and output smallest number using class, friend function and overloading.

  Programming concepts

The assignment problem is straightforward. All necessary details have been supplied. The solution of the problem will be straight line code which will use the programming concepts and strategies covered in Workshops 1-3. The subgoals are:

  Develop the payroll program to enter two double values

Develop the payroll program named CalcPay which permits the user to enter two double values namely hours worked and hourly rate.

  Display the total sales.

Display the salesperson with the top required sales.

  Find out the total of balances

Display all the contents of the file in a tabular format with the first row being a header row and write to a file that is called account numbers.txt only the account numbers from the read file.

  Write program to show percentage of calories come from fat

Write a program which asks user to enter number of calories and fat grams in a food item. The program must display percentage of the calories that come from fat.

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