online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
''' ICE code for practice in conditionals and boolean values File 1 Testing file -Dr. G 9/22/2021 No changes are needed in this file ''' from PredictTheOutput1Functions import * def main(): #Testing isItZero if(isItZero(3)): print("isItZero Test 1 Passed") else: print("isItZero Test 1 Failed") if(isItZero(0)): print("isItZero Test 1 Passed") else: print("isItZero Test 1 Failed") #Testing getHighest if(getHighest(1,2,3) == 3): print("Test 1 of getHighest Passed") else: print("Test 1 of getHighest Failed") if(getHighest(3,2,1) == 3): print("Test 2 of getHighest Passed") else: print("Test 2 of getHighest Failed") if(getHighest(1,3,2) == 3): print("Test 3 of getHighest Passed") else: print("Test 3 of getHighest Failed") #Testing checkRange if(checkRange(10,0,20)): print("Test 1 of checkRange Passed") else: print("Test 1 of checkRange Failed") if(checkRange(10,0,10)): print("Test 2 of checkRange Passed") else: print("Test 2 of checkRange Failed") if(checkRange(10,10,20)): print("Test 3 of checkRange Passed") else: print("Test 3 of checkRange Failed") if(not(checkRange(10,11,20))): print("Test 3 of checkRange Passed") else: print("Test 3 of checkRange Failed") #Testing odd if(oddNum(2) == "even"): print("Test 1 of oddNum passed") else: print("Test 1 of oddNum failed") if(oddNum(3) == "odd"): print("Test 2 of oddNum passed") else: print("Test 2 of oddNum failed") main()
''' ICE code for practice in conditionals and boolean values File 2 : Functions -Dr. G 9/22/2021 ''' #Example def isItZero(num): ''' Function for checking to see if a number is zero Parameters: 1 int Returning: a boolean value ''' if (num == 0): return True else: return False #Task 1 : Create a function that accepts three numbers and prints the highest def getHighest(num1, num2, num3): ''' Function for computing the higest number from three numbers Parameters: 3 ints Returning: 1 int (the higest number of the three inputs) ''' result = num1 #missing code return result #Task 2 : Create a function that accepts a number and a range return a boolean to show if the number is in that range def checkRange(num1, start, end): ''' Function for checking to see if a number is within a specified range Parameters: 3 ints num1 - number to be compared start - beginning of range inclusive end - end of the range inclusive Returning: boolean (true if it is in range false otherwise) ''' #replace "False with the correct boolean expression result = (False) return result #Task 3 : Return "odd" if the number is odd and even if the number is even def oddNum(num): ''' Function for checking to see if a number is odd Parameters: 1 ints num1 - number to be checked Returning: string ("odd" if it is odd "even" if it is even) ''' return "odd"

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue