Devcult - 6G and Satellites
1 min readApr 27, 2019

Chapter 4 :Introducing Python Object types

Everything is an object in Python: from simple numbers to strings.

The python conceptual hierarchy

  1. Programs are composed of modules
  2. Modules contain statements
  3. Statements contain expressions
  4. Expressions create and process objects

Python’s Core Data Types

  • Numbers: 124, 12.3, Decimal(), Fraction()
  • Strings: 'spam’, 'a\246'
  • Lists: []
  • Dictionaries: {}
  • Tuples: ()
  • Files: open()
  • Sets: {}
  • Other core types: Boolean, types, None
  • Program unit types: Functions, modules, classes
  • Implementation related types: Compiled code, stack tracebacks

Numbers

  • int
  • float
  • complex
  • decimals
  • rationals
  • sets

There are two waya to print every object in Python- with full precision(as-code repr) and the second is it’s user-friendly str.

If something looks odd, try showing it with a print function

Strings

Strings are used to record both textual information as well as arbitrary collection of bytes.

Index of string starts from 0. s[0] gives the first character of the string. s[-1] gives the last item from the end in the string s

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Devcult - 6G and Satellites
Devcult - 6G and Satellites

No responses yet

Write a response