Skip to content

Latest commit

 

History

History
44 lines (37 loc) · 666 Bytes

File metadata and controls

44 lines (37 loc) · 666 Bytes

Print and variables

print "hello world"
name = "Brian"
print "my name is", name

Input from the user

your_name = input("What is your name?")
print "your name is", your_name

If and if/else

if your_name == "Brian":
  print "That is my name too!"
else:
  print "Hello friend"

Variable types

your_age = input("What is your age?")
if your_age == 10:
  print "Does this if work?"
your_age = int(input("What is your age?"))

Loops

for x in range(10):
  print "Hello", x
user_input = ""
while user_input != "end": 
  user_input = input("Type end to stop")