Assignment 17 — conditional analysis
Due Monday, October 22
Program same_difference.py
- Produce a program that prompts its user for two integer inputs and reports whether or not they have same sign.
- They have the same sign if they are both positive or are both negative. For assignment purposes, zero is a positive number. If they have the same sign, print
'have same sign'
; otherwise, print'have different signs'
.
- The only program output besides the prompt is the relationship between the two input values.
- Four sample runs
Enter two numbers: 3 -5have different signs
Enter two numbers: -2 -1have same sign
Enter two numbers: 8 8have same sign
Enter two numbers: -12 11have different signs
© 2019 Jim Cohoon | Resources from previous semesters are available. |