Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. '''
  2. Title: Variables
  3.  
  4. Description/Explanation/Lesson:
  5.  
  6. Variables in Python are defined using the '=' operator. For example: myAge = 18
  7. Variables can contain Strings, Numbers, Lists, Class Instances, and many more things!
  8. Variables can also contain operations & methods i.e. eightSquared = 8 ** 2
  9. Or, binaryFromDecimal = bin(243)
  10.  
  11. Code Prompt/Challenge:
  12.  
  13. 1. Define a variable 'myName' and set it to your name as a String
  14. 2. Define a variable 'myAge' and set it to your age as a Number
  15. 3. Define a variable 'tenMore' and set it to the your age + 10
  16.  
  17. Pre-defined Code:
  18.  
  19. Solution:
  20.  
  21. myName = 'Ethan'
  22. myAge = 18
  23. tenMore = 18 + 10
  24.  
  25. Tests:
  26.  
  27. self.assertIsInstance(myName, str)
  28. self.assertIsInstance(myAge, int)
  29. self.assertIsInstance(tenMore, int)
  30. self.assertEqual(myAge + 10, tenMore)
  31.  
  32. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement