Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. def rainbow_or_age(rainbowage):
  2. if rainbowage.isalpha(): # checks if the argumment is an alphabet and does the follwing
  3. Print("String")
  4. elif rainbowage.isdigit(): # checks if argumment is a digit and does the following
  5. print("Digit")
  6. else:
  7. return False
  8.  
  9.  
  10.  
  11. rainbow_or_age(2) # here i call the fucntion
  12.  
  13. # here i get the error!
  14. #---------------------------------------------------------------------------
  15. #AttributeError Traceback (most recent call last)
  16. #<ipython-input-25-e32b3f32e450> in <module>()
  17. #----> 1 rainbow_or_age(2)
  18.  
  19. #<ipython-input-19-1659c3081cd9> in rainbow_or_age(rainbow)
  20. # 2 def rainbow_or_age(rainbow):
  21. # 3 rainbowage = rainbow
  22. #----> 4 if rainbowage.isalpha():
  23. # 5 return rainbow_color() , rainbowage
  24. # 6 elif rainbowage.isdigit():
  25.  
  26. #AttributeError: 'int' object has no attribute 'isalpha'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement