Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour), the National Weather Service defines the effective temperature to be: w = 35.74 +0.6215 t + (0.4275 t - 35.75) * v^0.16 Compose a program that takes two floats t and v from the command-line and prints the wind chill value w
Given the temperature t (in Fahrenheit) and the wind speed v (in miles per hour), the National Weather Service defines the effective temperature to be: w = 35.74 +0.6215 t + (0.4275 t - 35.75) * v^0.16 Compose a program that takes two floats t and v from the command-line and prints the wind chill value w
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
write in python language please
Expert Solution
Step 1
Steps to write the code is :
1. checking number of the command line arguments is 3
2. converting the second command line argument to t
3. converting the third command line argument to v
4. validating the value of t
5. validating the value of v
6. otherwise
7. calculating wind chill using t and v
8. printing the value of w
Python code to calculate wind chill using inputs t and v is :
import sys
# checking number of the command line arguments is 3
if len(sys.argv) == 3:
# converting the second command line argument to t
t = float(sys.argv[1])
# converting the third command line argument to v
v = float(sys.argv[2])
# validating the value of t
if t > 50:
print("Value of t must be <= 50 F")
# validating the value of v
elif v <= 3:
print("Value of v must be > 3 mph")
# otherwise
else:
# calculating wind chill using t and v
w = 35.74 + 0.6215 * t + (0.4275 * t - 35.75) * (v ** 0.16)
# printing the value of w
print(w)
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education