#boolean data types
boolean1=True
boolean2=False
# continues executing the instruction while the condition is true while (condition)
count =0
#use while when you don't know how much you have to loop it
while (count<20):
if count==5:
break #stop the loop
print(count)
#count =count +1
count +=1
#input loop
while(True):
inputString =input("Say something\nType Q to quit\n")
if inputString =='Q':
break
print (inputString)
#FOR LOOP
#usally very useful is list
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
for day in weekdays:
print (day)
#range in function, range (start,stop,step
for i in range (0,11):
print(i)
for x in range (0,5):
print (x**2)
No comments:
Post a Comment