-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunit-6-assignment.py
More file actions
36 lines (26 loc) · 839 Bytes
/
unit-6-assignment.py
File metadata and controls
36 lines (26 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
# first we need to define the function and ask for to arguments
def compare(a,b):
#case 1 when the first number is greater than the second number
if a > b :
return 1
# case 0 when the twon numbers are equals
elif a == b:
return 0
# case -1 when the the second number is greater than the first one
else :
return -1
# now testing the 3 cases by static values
print (compare(5,2))
print (compare(2,5))
print (compare(3,3))
# prompting and storing the first number
user_input_A = input("Please enter the first number to compare\n")
#prompting and storing the second number
user_input_B = input("Please enter the first number to compare\n")
# compare and print the return value
print(compare(user_input_A,user_input_B))