Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives. Write simple straight-line Python programs that involve the following 1. Command-line input 2. The four basic built-in types of data: str, int, float, and

image text in transcribedimage text in transcribed

Objectives. Write simple straight-line Python programs that involve the following 1. Command-line input 2. The four basic built-in types of data: str, int, float, and bool. 3. Calls to library functions Problem 1. (Name and Age) Write a program name_ age.py that takes two strings name and age as command-line arguments and writes the output "name is age years old.". python3 name-age.py Alice 19 Alice is 19 years old Problem 2. (Greet Three) Write a program greet_three.py that takes three strings namel, name2, and name3 as command line arguments and writes the output "Hi name3, name2, and name1.". $python3 greet three py Alice Bob Carol Hi Carol, Bob, and Alice. Problem 3. (Triangle Inequality) Write a program triangle.py that takes three integers as command-line arguments and writes True if each one of them is less than or equal to the sum of the other two and False otherwise. Note: this computation tests whether the three numbers could be the lengths of the sides of some triangle python3 triangle.py 3 4 5 True python3 triangle.py 2 4 7 Problem 4. (Trigonometric Functions) Write a program trig.functions.py that takes a float t (angle in degrees) as command line argument and writes the value of sin(2t) sin(3t) $ python3 trig.functions.py 60 0.8660254037844388 Problem 5. (Displacement) Write a program displacement.py that takes three floats ro, vo, and t as command-line arguments and writes the value of ro vot gt2/2, where g is the constant 9.78033 meters per second per second. Note: this value is the displacement in meters after t seconds when an object is thrown straight up from initial height xo meters with velocity vo meters per second s python3 displacement.py 10 0 1 5 . 109835 Files to Submit 1. name age.py 2. greet three.py 3. triangle.py 4. trig functions.py 5. displacement.py

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions