Code Circle
  • Home
  • Team
    • Admin Team
    • Board of Directors
  • Join Us
    • Teach A Course
    • Become A Partner
  • Partners
  • Programs
    • App Design & Development
    • Python Course >
      • Python Course Week 1: Introduction >
        • Gmail Account Setup
        • Repl.it Setup
      • Python Course Week 2: Numbers (Ints and Doubles) >
        • Variables
        • Integers
        • Integer Operations
        • Doubles
        • Summary
        • Python Ints Quiz
      • Python Course Week 3: Strings >
        • Printing, Assigning, and Concatentating
        • Converting With Strings
        • Indexing
        • Summary
        • Strings Cheat Sheet
        • Strings Error Log
        • Python Strings Quiz
      • Python Course Week 4: Booleans >
        • Practicality
        • Comparisons
        • Logical Statements
        • Summary
        • Error Log
        • Boolean Quiz
        • Mid-Course Survey
      • Python Course Week 5: Conditional Statements >
        • If Statements
        • Else/Else If Statements
        • While Loops
        • If Statement Logic
        • Summary
        • Cheat Sheet: Conditions
        • Conditionals Error Log
        • Quiz: Conditional Statements
      • Python Course Week 6: For Loops >
        • For Loops
        • For Loops Syntax
        • Loop Errors
        • Summary
        • Using Loops in Problems
        • Quiz: For Loops
      • Python Course Week 7: Lists >
        • Functions
        • Iterating Through A Loop
        • Summary
        • Error Log
        • Quiz: Lists
      • Python Course Week 8: Functions and Programs >
        • All About Functions
        • All About Programs
        • Post-Course Quiz
        • Python Course Final Project
    • Global Ambassadors

Strings "Cheat Sheet"

Defining Strings

Use either “ “ or ‘ ‘. Don’t use them together otherwise you’ll get an error message! You can assign Strings a variable like an int or a double. They can be assigned to a variable, as seen below.
Picture

Printing

Use the print() method. You can directly print strings or print from a variable. You can also concatenate strings within the method. ex: print(string1 + string2)

Concatenating

Use the + symbol between String. If you want to add a space between the strings, don’t forget to add a “ “.

Strings → Ints and Ints → Strings

When you want to combine an int and a string, write str(variable) to convert the int to a string.​
Picture

Indexing

This allows you take a specific character or set of characters from a string.
Remember that the index starts with 0, not 1! The first character would have the index of 0, not 1.
To get a letter at a specific index, you write string[index].
To get a specific segment of a string, you use the following function: write string[a:b]
a is the index that the substring will start from. b-1 is the index that the substring will end on. if you write no values for a and b: string[:], you will get the entire string.
Picture
len() is used to find the length of a string.
Picture
previous
continue with week 3
Powered by Create your own unique website with customizable templates.
  • Home
  • Team
    • Admin Team
    • Board of Directors
  • Join Us
    • Teach A Course
    • Become A Partner
  • Partners
  • Programs
    • App Design & Development
    • Python Course >
      • Python Course Week 1: Introduction >
        • Gmail Account Setup
        • Repl.it Setup
      • Python Course Week 2: Numbers (Ints and Doubles) >
        • Variables
        • Integers
        • Integer Operations
        • Doubles
        • Summary
        • Python Ints Quiz
      • Python Course Week 3: Strings >
        • Printing, Assigning, and Concatentating
        • Converting With Strings
        • Indexing
        • Summary
        • Strings Cheat Sheet
        • Strings Error Log
        • Python Strings Quiz
      • Python Course Week 4: Booleans >
        • Practicality
        • Comparisons
        • Logical Statements
        • Summary
        • Error Log
        • Boolean Quiz
        • Mid-Course Survey
      • Python Course Week 5: Conditional Statements >
        • If Statements
        • Else/Else If Statements
        • While Loops
        • If Statement Logic
        • Summary
        • Cheat Sheet: Conditions
        • Conditionals Error Log
        • Quiz: Conditional Statements
      • Python Course Week 6: For Loops >
        • For Loops
        • For Loops Syntax
        • Loop Errors
        • Summary
        • Using Loops in Problems
        • Quiz: For Loops
      • Python Course Week 7: Lists >
        • Functions
        • Iterating Through A Loop
        • Summary
        • Error Log
        • Quiz: Lists
      • Python Course Week 8: Functions and Programs >
        • All About Functions
        • All About Programs
        • Post-Course Quiz
        • Python Course Final Project
    • Global Ambassadors