Python Scripting

User Generated

abgncvengr

Programming

Description

The file attached has the instructions, let me know if you have questions. Thank you for your time and effort.

There is only one file attached:

lab4_IntroToPython.docx

Unformatted Attachment Preview

[IFT 383] Shell & Script Programming with Unix LAB ACTIVITY: INTRO TO PYTHON Directions 1) Your programs must be save in a file with extension .py so they can be run from the command line as: python youfile.py 2) For every program, you must first develop an algorithm. 3) Your output should be formatted exactly as the sample runs provided, including the precisions for decimal numbers. Introduction This is the introductory part and doesn’t use control structure, functions, or files I/O. The learning objectives are twofold: 1) Develop proper algorithm for solving a given program. The instructions in the algorithm will serve as comments in your program 2) Turn the algorithm into code Activities Part 1: Minimum Number of Coins Suppose you want to develop a program that classifies a given amount of money into smaller monetary units. The program lets the user enter an amount as a floating-point value representing a total dollars and cents, and then outputs a report listing the monetary equivalent in dollars, quarters, dimes, nickels, and pennies. Your program should report the maximum number of dollars, then the number of quarters, dimes, nickels, and pennies, in this order, to result in the minimum number of coins. Sample Run Enter an amount, for example, 11.56: 11.56 Your amount 11.56 consists of: 11 dollars 2 quarters 0 dimes 1 nickels 1 pennies Page | 1 [IFT 383] Shell & Script Programming with Unix Part 2: Displaying the current time The problem is to develop a program that displays the current time in Greenwich Mean Time (GMT) in the format hour:minute:second, such as 13:19:18 The time() function in the time module returns the current time in seconds with millisecond precision elapsed since the time 00:00:00 on January 1, 1970 GMT. This time is known as the UNIX epoch. The epoch is the point when time starts. 1970 was the year when UNIX operating system was formally introduced. For example, time.time() returns 1285543663.205, which means 1285543663 seconds and 205 milliseconds. You can use this function (the time() function in the time module) to obtain the current time, and then compute the current second, minute, and hour. Sample Run: Current time is 17:31:8 GMT Part 3: Computing Distances Given two points, the formula for computing the distance is √(𝑥2 − 𝑥1 )2 + (𝑦2 − 𝑦1 )2 Write a program that prompts the user to enter two points and computes the distance between them. Note that each point is characterized by two float values, representing the x-axis and y-axis. Sample Run Enter x1 and y1 for Point 1: 1.5, -3.4 Enter x2 and y2 for Point 2: 4, 5 The distance between (1.5, -3.4) and (4, 5) is 8.8 Submissions Submit all the required files through Blackboard. You are to submit two (2) files: (1) A zip file of your 3 .py files (2) This document with your test run incorporated. Note that the comments (which result from writing an algorithm first) are a major part of the grading criteria. Page | 2
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

The scripts are written. I am uploading zip file with thre...


Anonymous
Excellent! Definitely coming back for more study materials.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags