Knowledge7

The Linux and Mobile Solution Provider

  • About
  • Training
  • Services
  • Clients
  • In the news
  • Blog
  • Contact Us
You are here: Home / Topic / Using Linear Containers

Using Linear Containers

This topic is part of our Mastering Computer Programming training

A string (e.g. “Hello”) is a collection of characters (unlike a boolean, an integer or a float which are scalar value). In Chapter 7 of the book, we will use strings to build progressively more complex (and more interesting) programs.

Like in Java, strings in python are immutable to increase performance and decrease space requirements.

It is important to understand the following aspects of Strings:

  • Indexing
  • The len() function
  • Traversal using an index and a for loop
  • Slices
  • The in and not in operators
  • The Python string module

String formatting is an advanced topic and is not essential at this point.

Work out all the examples in the book (except those pertaining to string formatting which can be skipped on a first reading). When you have understood everything, work out the two exercises in section 7.14.

Comment on the power of doctest and slices. For those who have prior exposure to other programming languages, what do you think of Python’s way of managing string?

Powerful strings

Work out exercises 1, 2, 5, 6 and 8 in section 7.16. How do you find is_palindrome? What about remove_all?

A lot of people say that modern programming languages like Python allow programmers to program elegantly. Do you think so?

This topic is part of our Mastering Computer Programming training

Our forthcoming training courses

  • No training courses are scheduled.

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for something?

Want to know more?

Get our newsletter

Discover the latest news, tips and tricks on Linux, the Web and Mobile technologies every week for FREE

This work is licensed by Knowledge7 under an Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.