IT 116: Introduction to Scripting
Homework 4

Due

Sunday, February 18th at 11:59 PM

What You Need to Do

Setup On Your Machine

Specification

Output

Suggestions

  1. Write an assignment statement using the input function that asks the user for the diameter and gives this value to the variable diameter.
    Convert this value to an decimal using float().
    Print the value.
    Run the script.
    Fix any errors you find.
  2. Remove the print statement you wrote in the previous step.
    Replace it with an if statement that will run if the value of diameter is less than or equal to 1.25.
    Inside this if clause, assign type the value "Terrestrial".
    Outside this if statement, print the value of type.
    Run the script.
    Fix any errors you find.
  3. Add an elif clause under the if statement that will run if the value of diameter is less than or equal to 2.
    Inside this clause set the value of type to "Super-Earth".
    Run the script.
    Fix any errors you find.
  4. Repeat the above step for the type "Neptune-like".
  5. Add an else clause that sets the value of type to "Gas Gian".
    Run the script.
    Fix any errors you find.

Testing on Your Machine

Copy the Script to Unix

Testing the Script on Unix (Optional)

Copyright © 2023 Glenn Hoffman. All rights reserved. May not be reproduced without permission.