Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #Black Girls Code Summer of Code '17
  2. #Variables, Functions and Classes
  3. #July 25, 2017
  4.  
  5. # DATA TYPES: Strings & Integers
  6.  
  7. name = "Sasha"
  8. age = "12"
  9.  
  10. # 'name' is the String, 'age' is the Integer
  11. # the equal sign is extremely important!
  12.  
  13. num1 = 10
  14. num2 = 15
  15.  
  16. num3 = num1 + num2
  17.  
  18. # what's the value of num3?
  19. # answer: 25
  20.  
  21. ## Integer Operations
  22.  
  23. a = 5
  24. b = 8
  25.  
  26. a + b #returns 13; addition
  27. a * b #returns 40; multiplication
  28. a - b #returns -3; subtraction
  29. a / b #returns 0.625; division
  30.  
  31. ## String Operations
  32.  
  33. first = "Sasha"
  34. last = "Fierce"
  35.  
  36. beyonce = first + " " + last #returns: Sasha Fierce
  37.  
  38. ## Invalid Operations
  39.  
  40. name + age #returns an error; can't mix Strings and Integers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement