Previous Lecture Lec 4 Next Lecture

Lec 4, Wed 01/15


Announcements

General Questions

Review…

iClicker Questions:

New Material

User Input

num = input("What is your favorite number?")
print("you said ", num)
num = int(num)        # this forces their input to be type int rather than str
print("mine is ", num + 1)

Escape Key

>>> 'O\'Brian said "Pay attention!" '
'O\'Brian said "Pay attention!" '

The print function removes the escape characters:

>>> print('O\'Brian said "Pay attention!" ')
O'Brian said "Pay attention!"