Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Title: Variables
- Description/Explanation/Lesson:
- Variables in Python are defined using the '=' operator. For example: myAge = 18
- Variables can contain Strings, Numbers, Lists, Class Instances, and many more things!
- Variables can also contain operations & methods i.e. eightSquared = 8 ** 2
- Or, binaryFromDecimal = bin(243)
- Code Prompt/Challenge:
- 1. Define a variable 'myName' and set it to your name as a String
- 2. Define a variable 'myAge' and set it to your age as a Number
- 3. Define a variable 'tenMore' and set it to the your age + 10
- Pre-defined Code:
- Solution:
- myName = 'Ethan'
- myAge = 18
- tenMore = 18 + 10
- Tests:
- self.assertIsInstance(myName, str)
- self.assertIsInstance(myAge, int)
- self.assertIsInstance(tenMore, int)
- self.assertEqual(myAge + 10, tenMore)
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement