Beginner Python Concepts


Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Hello World

This is the classic "Hello World" program in Python. This will print whatever String (array of chars / group of letters) you have between the single (' ') or double quotes (" ")

Hello World!

Being able to print output is very important in coding. You can use print statements to see the values of variables, if sections of code are being executed, or the results of your algorithm.

Formatting is a major part of problem solving with code. String manipulation can be done a few ways in Python

    print("Hello! " * 3)

For the rest of the examples, let's declare a String variable to use

    test_string = "Hello World, but now our new string!"

Slicing is where you target or work with only parts of a string. To do this, use square brackets ([]). Within the square brackets you can set the start, stop, and step. Or in other words, the starting point, ending point, and how much to count by


Print every other letter


Reverse the string


Print single char at a certain index


This also works backwards with a negative index


Set the start point as the fifth character from the end

Try them!
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content