Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  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!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement