CSCA20 - WORKSHEET 4.pdf

1 Page
239 Views
Unlock Document

Department
Computer Science
Course
CSCA20H3
Professor
Anya Tafliovich
Semester
Summer

Description
CSCA20 ° list (range(10,20,2)) Worksheet 4 • [10, 12, 14,16,18] • Input and output ° If step is omitted, the default is 1 ♦ Built-in function input “waits” for the user to ° If x is omitted, the default is 0 enter input. Once the user enters the input, the ° The step can also be negative value of input() is the string which contains what • Slicing lists the user entered. ♦ Similar to slicing strings ♦ Example • Aliasing ° name = input (“What is your name?”) ♦ Sometimes we have two variables that are names • What is your name? Ziren of the same object; they refer to the same object. • Name -> Ziren This is called aliasing. • While loops ♦ Slicing creates a new object. ♦ A while loop allows us to continue looping as • Nested lists long as some condition is True. ♦ Lists can contain lists ° while : • Nest loops • ♦ Use for loops in a nested lists ° while is a the Python keyword • Aliasing again ° condition is a boolean that must be True to ♦ list = [list1, list2, list3] enter/repeat t
More Less

Related notes for CSCA20H3

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit