File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ '''
2+ question-2.py - Michael Bateman
3+ Python Coding Bat Test - ICS3U
4+ Feb 16/17
5+ '''
6+
7+ # imports - none
8+
9+ # functions
10+
11+ def sortaSum (int_a , int_b ): # this creates a function called 'sortaSum' that can recieve data
12+ totalsum = int_a + int_b # this creates the sum stored in a variable called 'totalsum'
13+ if ((10 <= totalsum <= 19 ) == True ): # this checks to see if the total sum is between 10 and 19 (inclusive).
14+ return 20 # if it is between 10 and 19, it just returns 20
15+ else :
16+ return totalsum # if it is not between 10 and 19 it returns to real sum
17+
18+ # user input
19+
20+ int_a = input ("Please enter your first number: " ) # here, the user will input a number that is stored in 'int_a'
21+ int_b = input ("Please enter your second number: " ) # then, a second number is asked and it is stored in 'int_b'
22+ # both 'int_a' and 'int_b' data types are int's
23+
24+ # raw code
25+
26+ print (sortaSum (int_a , int_b )) # prints what is returned in in the 'sortaSum' function
You can’t perform that action at this time.
0 commit comments