Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # don't forget to un comment ( remove the pairs of """ )
- Colin
- # forever loop
- """
- while True:
- print("hello")
- input("")
- """
- # condition controlled loop
- # keep going until "Q" is pressed
- """
- option = "" # sentinal value
- while option != "Q":
- print("Colin was here")
- option = input("Enter a letter or Q to quit ")
- print("you pressed >>",option)
- print("loop exited")
- """
- # count controlled loop
- # know how many times our loop will run
- # len(variable_name) => integer
- # print number 1 - 5 inclusive
- num =1
- for i in range(5):
- print(num)
- num= num+1
- print("line29",num)
- # print out the letters in a word one by one
- """
- my_word = input("Let's have a word >>")
- for i in range(len(my_word)):
- print(i)
- print(my_word[i])
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement