Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Black Girls Code Summer of Code '17
- #Variables, Functions and Classes
- #July 25, 2017
- # DATA TYPES: Strings & Integers
- name = "Sasha"
- age = "12"
- # 'name' is the String, 'age' is the Integer
- # the equal sign is extremely important!
- num1 = 10
- num2 = 15
- num3 = num1 + num2
- # what's the value of num3?
- # answer: 25
- ## Integer Operations
- a = 5
- b = 8
- a + b #returns 13; addition
- a * b #returns 40; multiplication
- a - b #returns -3; subtraction
- a / b #returns 0.625; division
- ## String Operations
- first = "Sasha"
- last = "Fierce"
- beyonce = first + " " + last #returns: Sasha Fierce
- ## Invalid Operations
- name + age #returns an error; can't mix Strings and Integers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement