Skip to content

Latest commit

 

History

History
30 lines (17 loc) · 507 Bytes

File metadata and controls

30 lines (17 loc) · 507 Bytes

Commands used in the Egghead.io Series Intro to Python

Lesson Three - Use Python Interactively with the REPL Console

Command to start a python console:

python

Code to print a string in Python 2:

print "Hello World"

Code to print a string in Python 3:

print("Hello World")

Code to import the datetime module:

import datetime

Code to create a function the sums two numbers:

def add(num1, num2):
    return num1 + num2

Code to execute the function created above:

add(1,2)