March 23, 2018

What are Strings in Python Programming?

by codingworkshop

What are Strings in Python Programming?


Python is great at working with numbers, but what about when we want to communicate with people? To write programs that people can use, we need another variable type known as STRINGS.

Strings are what we call TEXT, or keyboard characters, in a programming language; they are groups (or ‘strings’) of letters, numbers, and symbols.

Your name is a string, as is your favourite colour.

A common way to use strings is in printing.

Let’s create a program that asks the user for their name, store their name in a variable called name, and then print their name on the screen 100 times!

What are strings in python proramming

There’s something new in the print() statement in the program’s last line: it contains a keyword.

A keyword is a special, reserved word that means something in a particular programming language.

The keyword here is the ‘end’, and it tells the program to END each print() statement with a space (there’s a space between our quotes: “ “) instead of the regular end-of-line character.

With this end keyword argument we are telling Python we don’t want every printout of our name to be on a new line.

Strings in Python Programming

Source: Teach Your Kids to Code: A Parent Friendly Guide to Python Programming by Bryson Payne, No Starch Press


Free Online Coding Courses, Python, Strings Python Programming

You may also like

Free Online Coding Courses for Kids | What is the World Wide Web?

What skills do kids gain from learning coding? | Online Coding & Digital Education