


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Intro to Computer Science I; Subject: Computer Science; University: University of San Francisco (CA); Term: Unknown 1989;
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!
while condition: statements x= while x < 10: print x x = x + 1
x=1 #initialization of control variable while x < 10: #condition print x #task to be repeated x = x + 1 #update - VERY VERY IMPORTANT
num = input("Enter number - 0 to quit: ") while num != 0: print “You entered “, num num = input("Enter number - 0 to quit: ")
num = input("Enter number between 0 and 100: ") while num < 0 or num > 100: #a more complex condition print "Invalid input" num = input("Enter number between 0 and 100: ")
for x in range(10): print x mystring = "CS is cool!" for c in mystring: print c
x= while x==1: print “x is 1”
x= end_value= while x != end_value: #do something
while 1: num = input(“Enter a number - 0 to quit: “) if num == 0: break #combines intialization and update
#import the module random import random #call the randint function passing in the range num = random.randint(1, 10)