Write program to determine whether a triangle is right

Assignment Help Python Programming
Reference no: EM132310026

Introduction to Programming Assignment -

Purpose of the assessment (with ULO Mapping) - Assess student's ability to develop algorithmic solutions to programming problems using Python language.

Assignment Specifications -

Purpose: 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 develop and run python programs, and your ability to write meaningful comments when necessary.

1. Write a program triangle.py to determine whether a triangle is a 'right triangle'. A right triangle is a triangle where the square of one side equals the sum of the squares of the other two sides. Your program should prompt the user to enter the three sides of a triangle - one at a time - and then print a statement indicating whether or not the triangle is right.

2. Bit shifting is a process where the bits of a given string are moved to the left or to the right. For instance, the bits in the string 1110 becomes 1011 when shifted two places to the left. Notice that the leftmost two bits are wrapped around to the right side of the string in this example. Write a program shift.py which take a bit string as an input. The program prompts the user to enter a string of binary bits. The program allows the user to determine the direction of shifting by entering L for left shift or R for right shift. Once the bits string is entered and the shift direction is specified, the program shifts the bits two places either to the left or to the right according to the user choice. Finally, the program prints the resulting string.

3. The mathematical value of π can be approximated using the following equation:

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

The higher number of iterations, the more accurate the approximation is. For instance, and iteration of two (π/4 = 1 - 1/3) yields a value 2.66 of for π, while an iteration of 100 yield a value of 3.13. Write a program pie.py that prompts the user to enter the number of iterations in this method of approximation and prints out the resulting value of π.

4. Company A keeps a record of its employee payments in a text file. Each line in the file is formatted as follows:

<first name> <hourly rate> <hours worked>

Write a program wage.py that prompts the user to enter a filename as an input and prints a report of the payments made to employees. For each employee, the total payment is calculated by multiplying their hourly payment rate by the number of hours they worked. The report must be formatted in a tabular format with the above header.

5. Design a game where the player rolls a couple of dices. The rules of this game are as follows: if the total dots of the two dices add up to seven, the player wins four dollars. For any other value, the player loses one dollar. The casino claims that there are many ways for the players to wine. For example, if the dots of the two dices are (1, 6), (2, 5) ... (5,2), (6, 1). In reality, there is a very little chance for anyone to win this game. Your task is to write a program dice.py which demonstrates that playing the game is pointless. Your program should prompt the user to enter the amount of money they wish to invest in this game, and play the game until this amount is depleted (becomes zero). At this point, the program prints a message that shows the number of rolls it took to break the player and the maximum amount of money the player won throughout the lifecycle of the game. (Hint: you may need to import the random module and randint function to solve this problem).

Verified Expert

It is python programming language based assignment.Ten different problems are solved and results are recorded in a separate word document.Problems solved in this assignment are checking type of a triangle, calculating value of pie, dice roll game, employee payroll maintenance, etc.,

Reference no: EM132310026

Questions Cloud

How the word defines the class experience for you : What words come to mind? Select five-to-six words that relate to learning theories, implications of social and environmental factors on learning, interactions.
Why would they make sense for a company like solazyme : What were the partnerships (with Unilever, Sephora, Qantas, and Roquette) designed to achieve, and why would they make sense for a company like Solazyme?
Write a reflection on the quoted idea : Select and quote an idea from each chapter of the Gollnick & Chinn text. Write a reflection on the quoted idea. Identify the page number.
As prescribed by the fair work act 2009 : As prescribed by the Fair Work Act 2009, what legal obligations and entitlements need to be observed when employers and employees
Write program to determine whether a triangle is right : HS1031 Introduction to Programming Assignment, Holmes Institute, Australia. Write a program triangle.py to determine whether a triangle is a 'right triangle'
Research and analyse new trends impacting global businesses : HC3031 - Trends in the Global Business Environment - Group Report and Power point presentations - research and analyse new trends impacting global businesses
Management issue or potential management issue : What is a management issue or potential management issue within the fashion icon Zara International?
How have your perceptions of what a teacher is changed : Based on the readings and InTASC standards, how have your perceptions of what a teacher is and does changed? How would you reconcile the InTASC Standards.
In how many months is demand completely satisfied : JNB535- BUSINESS ANALYTICS AND OPERATIONS RESEARCH- University of Tasmania- Australia- In how many months is demand completely satisfied?

Reviews

len2310026

5/22/2019 2:53:53 AM

No Of Pages/Words – 5. Python programs should be made in software in idle 3 please and make sure before it is saved as .py it should be also saved as .txt file as well for 5 programs it would be 10 files 5 .txt and 5 .py program files please make in idle 3 software only. You are encouraged to avoid last minute submission so that you do not run into technical problems. You can only submit once. Thus, ensure that your work is final prior to submission.

len2310026

5/22/2019 2:53:47 AM

Submission Guidelines - There are five questions in this assignment which require you to write and submit five Python scripts. Please save each script in two different formats: .py and .txt prior to submission. For example, for the first question you need to submit triangle.py and triangle.txt. Code must be appropriately commented. Make sure to add comments at each segment of your code to explain what it does. Make sure that your code runs successfully for all possible entries. Try to approach the solution with the least number of steps. Your code must be clear, logical, and easy to understand. All work must be submitted to Blackboard by the due date.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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