6. Python – Range function
Generate a sequence of numbers
Syntax:
◦ range(start, stop, step_size)
Step size is 1 by default
Does not store all values in the memory
To force the execution, use list() function
Can be used to iterate certain number of times in for loop
7. Python – String
Sequence of Unicode characters
Single character is a string with length 1
Square brackets [] can be used to access elements of string
Single quotes or double quotes or even triple quotes can be used to represent
Immutable – Elements of a string cannot be changed
8. Python – String contd.
Built-In methods to manipulate strings
Methods Purpose
format() formats string into nicer output
lower() returns lowercased string
upper() returns uppercased string
join() returns a Concatenated String
split() splits String from Left
find() returns the index of first occurrence of substring
replace() replaces Substring Inside
9. Python - Summary
❖Looping statements
❖For, While, Nested looping statements
❖Range function
❖String and String methods