Homework Assignment #7 Decisions in Python – Booleans and Ifs. It must include: • Commented-out assignment information at the top: name, course, date, etc. • The code for the program listed below • The output generated when you run your program with test data/inputs. This will need to be commented out as a triple quote, multi-line comment. When running each program, your code should print out a header statement with your name, the assignment number, the program number, and a brief description of what the program does. This MUST be commented out. DO NOT use lists, dicts, sets, libraries, etc.
Program 1: “Classify Integers” • Write a program that asks the user to enter an integer numeric value, and then prints out that value and whether that value is negative, zero, or positive. o Even though an integer is entered, format its value with 2 decimal places for printing. o The wording you use to 1) prompt the user for the input and 2) give feedback to the user are up to you, but the instructions should be self-explanatory, and the output should be clear. It doesn’t have to be fancy - but it needs to be clear and work. • Format your output using f-string formatting
# Name: [Your Name]
# Course: [Your Course]
# Date: [Current Date]
# Assignment: Homework Assignment #7
# Program 1: Classify Integers
# Description: This program asks the user to enter an integer and classifies it as negative, zero, or positive.
# Prompt the user for an integer input
user_input = int(input("Please enter an integer numeric value: "))
# Classify the integer
if user_input < 0:
classification = "negative"
elif user_input == 0:
classification = "zero"
else:
classification = "positive"
# Print the result with formatted output
print(f"The value you entered is: {user_input:.2f}, which is {classification}.")
"""
Output when running the program with test data:
Please enter an integer numeric value: -5
The value you entered is: -5.00, which is negative.
Please enter an integer numeric value: 0
The value you entered is: 0.00, which is zero.
Please enter an integer numeric value: 10
The value you entered is: 10.00, which is positive.
"""
Make sure to replace [Your Name]
, [Your Course]
, and [Current Date]
with your actual information before running