DEV Community

Billy Okeyo
Billy Okeyo

Posted on • Updated on

Introduction to Python Programming Basics(Part 1)


A variable is a container for a value and it can be of various data types.

Variable Rules

  • Variable names are case sensitive
  • Variable names must start with a letter or underscore
  • Variables can have numbers but cannot start with numbers

Data Types 

int —  for numericals

string — for alphanumericals

float — for numerics with decimal points

boolean — true or false 


Strings in python can be written with either single or double quotes 


A list is a collection which is ordered and can be changed.
A list also allows duplicate members.

To create a list we usually use square brackets or we can use a constructor as shown below;


A tuple is a collection which is ordered and cannot be changed.
A tuple also allows duplicate members.

In creating tuples we use parenthesis


A set is a collection which is unordered and unindexed which means when I print a set now it won’t be in the same when i print it again.
A set doesn’t allow duplicate members


A dictionary is a collection which is unordered, indexed and changeable.
A dictionary doesn’t allow duplicate members.


A function is a block of code which executes upon calling 
Python is very sensitive to indentions and thus in creating functions, we make use of indents.

In creating functions we use the def keyword, as shown below


That’s all for now, I’ll be posting a continuation on this later on.

Top comments (1)

hobbolt profile image

As i learn python, would you be willing to help me develop an app? I am so new to coding.