Professional Documents
Culture Documents
LEARNING
Interact$with$the$user$(input$and$output) Text$(strings) Variables
Print$a$message Single$quoted CreaCng$a$variable
print('Hello, world!') 'perfect' celsius = 25
Print$mulCple$values$(of$different$types) Double$quoted Using$a$variable
ndays = 365 "credit" celsius*9/5 + 32
print('There are', ndays, 'in a year')
MulCVline
Asking$the$user$for$a$string
'''Hello,
name = input('What is your name? ') World!''' Whole$numbers$(integers)
Asking$the$user$for$a$whole$number$(an$integer) Add$(concatenate)$strings AddiCon$and$subtracCon
num = int(input('Enter a number: ')) 'Hello' + 'World' 365 + 1 - 2
MulCply$string$by$integer MulCplicaCon$and$division
Decide$between$opCons 'Echo...'*4 25*9/5 + 32
Decide$to$run$a$block$(or$not) Are$two$values$equal? Length$of$a$string Powers$(2(to(the(power(of(8)
x = 3 x == 3 len('Hello') 2**8
if x == 3:
print('x is 3') +two+equals+signs,+not+one Convert$string$to$integer Convert$integer$to$string
f __init__(self, format
self.format = format
Learn&more&in&Intro.&to&Programming(@(groklearning.com
return [f(self.for
else:
return funcs(sel
n__(self):