SHARE
TWEET

Untitled

a guest Feb 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # import random
  2. # i got rid of the random because its hard to test random numbers (you don't know what the value is!)
  3. # get input from you instead, you can randomize it later
  4.  
  5. # get input from user. - don't change this function!
  6. def getInput():
  7.     inp = input("Enter a number: ")
  8.     return inp
  9.  
  10. # make this function return true if the input parameter is even, false otherwise, you can change anything
  11. # here other than the function definition
  12. def isEven(someNumber):
  13.     if someNumber == 2:
  14.         return True
  15.     else:
  16.         return False
  17.  
  18. #this is calling your input function and assigning the results to a variable
  19. userInput = getInput()
  20.  
  21. #casting to an integer
  22. integerInput = int(userInput)
  23.  
  24. #put something here to print "you entered x as your input"
  25. #if you fuck this part up, ask me about concatenation
  26. print ("something here")
  27.  
  28. #this is where you use the isEven function (with return types!)
  29. if (isEven(integerInput)):
  30.     print ("Your number is even!")
  31. else:
  32.     print ("Your number is odd!")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top