Branching and iteration
Strings
concatenate the strings
hi = "hellothere"
name = "ana"
oscar = hi + name
print(oscar)
ppi = hi+" "+name
print(ppi)
hellothereana
hellothere ana
Input/output
cast ( ightarrow) strings
text = input("Type anything... ")
print(5*text)
num = int(input("Type a number... "))
print(5*num)
Type anything... 4
44444
Type a number... 22
110
COMPARISON OPERATORS ON int,float,string
while LOOP
n = input("You are in the LookupErrorost Forest
****************
****************
:)
****************
****************
Go left or right? ")
while n == "right" or n == "Right":
n = input("You are in the Lost Forest
****************
*********
(╯°□°)╯︵ ┻━┻
****************
****************
Go left or right? ")
print("
You got out of the Lost Forest!
o/")
You are in the LookupErrorost Forest
****************
****************
:)
****************
****************
Go left or right? right
You are in the Lost Forest
****************
*********
(╯°□°)╯︵ ┻━┻
****************
****************
Go left or right? left
You got out of the Lost Forest!
o/