name = "John"

print("Hi my name is " + name)
Hi my name is John

Numbers

age = 50
print("my age is ", age)
my age is  50

Booleans

nameTheo = True
nameJohn = False

Manipulating Strings

print("Theo\nHuntalas")
Theo
Huntalas
print("Theo\"Huntalas")
Theo"Huntalas
name = "Theo"
truePhrase = " is cool"

print(name + truePhrase)
Theo is cool
phrase = "hello"
print(phrase.upper())
HELLO
phrase = "HELLO"
print(phrase.lower().islower())
True
phrase = "HELLO"
print(len(phrase))
5
phrase = "Theo"
print(phrase[2])
e

Getting User Input

userName = input("Please enter your name")
userAge = input("What is your age")

print("Hi " + userName + "!" + "\nYour age is " + userAge) 
Hi Theo!
Your age is 16

Building a Calculator

num1 = input("Number 1?")
num2 = input("Number 2?")
userOp = input("+ for add, - for subtract, / for divide, * for multiply")

if userOp == "+":
    print(num1,"plus",num2,"is",int(num1) + int(num2))

if userOp == "-":
    print(num1,"minus",num2,"is",int(num1) - int(num2))

if userOp == "*":
    print(num1,"times",num2,"is",int(num1) * int(num2))

if userOp == "/":
    print(num1,"divided by",num2,"is",int(num1) / int(num2))
4 times 5 is 20

Guess the Number

import random

randomNum = random.randint(0,100)

print("Guess the random number")
Guess the random number