Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 502 Bytes

python.md

File metadata and controls

36 lines (26 loc) · 502 Bytes

Python

Variables

Define a variable

age = 25
name = 'Chris'

Strings

Get a letter at a specified index

name = 'Chris'
letterH = name[1]
# Contains: h

Get a part of a string

name = 'Zack Willy Morris'

# Start from the back
firstName = name[:-13] # Contains Zack

middleName = name[5:10] # Contains: Willy

# Define the starting letter and go through the end of the string
lastName = name[11:] # Contains: Morris