Limited time offer 20% OFF StudySoup Subscription details

Georgia Tech - CS 1301 - Class Notes - Week 4

Created by: Sarah Notetaker Elite Notetaker

Georgia Tech - CS 1301 - Class Notes - Week 4

School: Georgia Institute of Technology
Department: Computer Science and Engineering
Course: Intro to Computing
Term: Spring 2019
Tags:
Name: CS 1301 Week 4
Description: These notes cover some conditions of loops, enumerating, escape sequences, and importing string.
Uploaded: 02/01/2019
This preview shows pages 1 - 2 of a 5 page document. to view the rest of the content
background image CS 1301 
Language: Python 3
Break, continue, pass, strings Break­ ends a loop Continue­ says if a loop meets a certain point that it should skip that point and continue 
through the loop
Pass­ nothing happens when it is executed Example of all three in use:
Notice how the loop is made to run through the range(0,10) –the numbers 0 
through 9– and so it starts with 0 and doesn’t meet any of the if possiblities so 
it prints the else statement
Then it goes to 1 and again ends up printing the else statement When it reaches 2 it is told to continue, which means it should skip that
number and continue on with the function
And when it reaches 3 it is told to break, which ends the loop It is impossible to take anything specific out of a string, so if you want to exclude 
something out of a string (or even add something extra) it would prove useful to make a 
new empty string that runs through the old string that only takes in the values you want:
Example of adding to a string: Build a string containing all the letters from 
“jackets” 
twice Excluding from a string Example 1: Create a string containing all the letters of 
“jackets” 
that aren’t vowels Excluding from a string Example 2: Remove all the punctuation from the string 
entered as a parameter
background image String­ a compound data type This is to say that each factor in a string has an assigned position For example the word “people” has a numerical value tied to each letter “p” is 0, “e” is 1, “o” is 2, and so on The first values start at 0  So if we wanted to pull one specific factor out of a string we could could write the 
string and attach [#] to the end of it, with an actual numerical value in place of
#
Example: Ranges of Indices Just as you can pull out one factor from a string with the brackets you can also pull out a
range of factors
Example:
Notice how the space between grace and anne is considered a factor You can also add a third parameter to the brackets to make it count by a certain value Example: You can also use the third parameter to count backwards so long as the first parameter 
is a larger numerical value than the second parameter
Example:
Notice how the “g” in grace was left out of the PS because it the 
second parameter was 0. The same way that in range if you went from 
1 to 8 it would only go through the numbers 1 and 7 (1 less than the last 

This is the end of the preview. Please to view the rest of the content
Join more than 18,000+ college students at Georgia Institute of Technology who use StudySoup to get ahead
5 Pages 44 Views 35 Unlocks
  • Better Grades Guarantee
  • 24/7 Homework help
  • Notes, Study Guides, Flashcards + More!
Join more than 18,000+ college students at Georgia Institute of Technology who use StudySoup to get ahead
School: Georgia Institute of Technology
Department: Computer Science and Engineering
Course: Intro to Computing
Term: Spring 2019
Tags:
Name: CS 1301 Week 4
Description: These notes cover some conditions of loops, enumerating, escape sequences, and importing string.
Uploaded: 02/01/2019
5 Pages 44 Views 35 Unlocks
  • Better Grades Guarantee
  • 24/7 Homework help
  • Notes, Study Guides, Flashcards + More!
Join StudySoup for FREE
Get Full Access to GATech - Class Notes - Week 4
Join with Email
Already have an account? Login here
×
Log in to StudySoup
Get Full Access to GATech - Class Notes - Week 4

Forgot password? Reset password here

Reset your password

I don't want to reset my password

Need help? Contact support

Need an Account? Is not associated with an account
Sign up
We're here to help

Having trouble accessing your account? Let us help you, contact support at +1(510) 944-1054 or support@studysoup.com

Got it, thanks!
Password Reset Request Sent An email has been sent to the email address associated to your account. Follow the link in the email to reset your password. If you're having trouble finding our email please check your spam folder
Got it, thanks!
Already have an Account? Is already in use
Log in
Incorrect Password The password used to log in with this account is incorrect
Try Again

Forgot password? Reset it here