Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

3: Objects

( \newcommand{\kernel}{\mathrm{null}\,}\)

  • 3.0: Introduction
    This page discusses understanding Python objects such as strings, integers, and floats. It explores the connection between variables and objects and introduces containers like lists and tuples for holding multiple objects. The goal is to prepare readers to solve complex problems more efficiently with fewer variables.
  • 3.1: Strings Revisited
    This page covers string manipulation in Python, focusing on extracting characters using indexes from both the left and right. It introduces Unicode for diverse character representation and explains escape sequences for including special characters. Additionally, it offers exercises to enhance understanding, featuring functions like ord() and chr() for character encoding.
  • 3.2: Formatted Strings
    This page outlines learning objectives for using f-strings in Python, emphasizing their role in simplifying output with multiple values and number formatting. It defines f-strings, illustrates their use with examples, and demonstrates formatting techniques, including leading zeros and fixed precision.
  • 3.3: Variables Revisited
    This page offers insights into variables, objects, and references in Python, emphasizing that variables point to objects rather than having intrinsic identity or type. Key concepts are supported by memory diagrams, and functions like id() and type() are introduced for object information retrieval. The text encourages practical understanding through Python Tutor and includes exercises for visualizing memory diagrams and exploring variable-object relationships.
  • 3.4: List Basics
    This page discusses the fundamentals of lists in Python, detailing creation, access, and modification. Lists are defined with square brackets and can hold diverse data types. It covers key concepts like using indexes, the len() function to determine list length, and the dynamic nature of lists. Practice questions are included to reinforce skills in list creation, indexing, and modification.
  • 3.5: Tuple Basics
    This page discusses tuples in programming, detailing their features like immutability, which enhances memory efficiency and performance. It covers the structure of tuples, accessed via indexing, and contrasts them with mutable lists. The section also includes practical examples, creation and manipulation techniques, and the use of the `tuple()` function to create tuples from lists.
  • 3.6: Chapter Summary
    This page discusses fundamental programming concepts, including strings as Unicode representations, indexing methods, and the distinction between mutable lists and immutable tuples. It highlights the efficiency of F-strings for formatting and covers memory management techniques like obtaining object identity and type, supported by practical code examples.


This page titled 3: Objects is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by OpenStax via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?