Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

November 28, 2025

Design, Develop, Execute: A Practical Guide to Automation Scripts with Open Source Tools

Summary: Learn a practical, project-first approach to design, develop, and execute automation scripts using open source tools. This post explains planning, modular development, quality practices, and reliable execution for real-world automation.

Design, Develop, Execute: Automation Scripts with Open Source Tools

Automation can save hours of repetitive work and make testing far more reliable. But successful automation begins long before you open an IDE. It starts with clear design, the right tools, and disciplined execution. In this post I walk through a practical workflow for building automation scripts with open source tools: design, develop, and execute.

1. Design: Start with a Clear Scope and Modular Plan

Before writing any code, define exactly what you want to automate and why. Is this a one-off utility or part of a reusable framework? Map the process step by step and list inputs, expected outputs, and failure modes. Identify the target systems and how they expose interfaces: APIs, web pages, SSH, message queues, or CLIs.

Think in modules. Break complex tasks into small, testable functions. That reduces debugging time and makes it easier to reuse components in future projects. Decide early on where the automation will run and what dependencies it needs.

Use Git for version control and a hosted Git platform like GitHub or GitLab for collaboration. Manage tasks and milestones with an open source tracker—Taiga or Wekan are lightweight choices. Document the design with plain-language README files and simple diagrams describing flows and failure handling.

2. Develop: Choose Tools That Match Your Goals

Tool choice depends on the problem you are solving. For lightweight scripting and quick iteration, Python is hard to beat: readable syntax, powerful libraries, and a huge ecosystem. Useful Python libraries include requests for HTTP, selenium for browser automation, and paramiko for SSH.

If you are automating browser interactions and prefer headless Chromium control, consider Playwright or Puppeteer with JavaScript. For infrastructure and configuration automation, use Ansible, Puppet, or Chef. For shell-level tasks, bash remains practical and ubiquitous.

Write clean, maintainable code. Follow naming conventions, add concise comments, and handle errors explicitly. Implement logging so you can inspect what happened when something fails. Use linters and formatters—Pylint and Black for Python—to keep style consistent.

Testing is essential. Unit tests validate individual functions; integration tests validate the interaction between modules and real systems. Use mock services where appropriate to make tests deterministic and fast.

3. Execute: Run Automation Reliably at Scale

Execution is more than running scripts on a schedule. For simple jobs, cron on Linux or Task Scheduler on Windows is sufficient. For complex workflows and dependency management, use orchestrators like Apache Airflow or Prefect. These tools provide scheduling, retries, dependency graphs, and monitoring dashboards.

Integrate automation with CI/CD. Jenkins, GitLab CI, and GitHub Actions can trigger scripts on commits, on a schedule, or in response to events. This turns automation into a dependable part of your delivery pipeline.

Make sure that the runtime test environments are predictable. Use virtual environments or container images so dependencies are consistent across developer machines and execution hosts. Add robust error handling and notification: email, Slack, or webhook alerts so the team is notified immediately on failures.

After execution, analyze logs and reports. Post-run reviews help you spot flaky steps, performance bottlenecks, or opportunities to simplify the workflow. Treat automation as a living asset: iterate on scripts and orchestration as systems evolve.

Practical Patterns and Tips

  • Modular design: Build small, reusable functions. Prefer composition over monolithic scripts.
  • Idempotence: Make scripts safe to run multiple times without causing unwanted side effects.
  • Credential management: Use secrets stores or environment injection instead of hard-coding credentials.
  • Observability: Emit structured logs and metrics so you can diagnose issues quickly.
  • CI integration: Run tests and smoke checks in CI before scheduling production runs.

Tool Choices List

  • Version control: Git + GitHub/GitLab
  • Scripting: Python (requests, selenium, paramiko), JavaScript (Playwright, Puppeteer)
  • Config management: Ansible, Puppet, Chef
  • Orchestration: Apache Airflow, Prefect
  • CI/CD: Jenkins, GitLab CI, GitHub Actions
  • Linters/formatters: Pylint, Black
  • Task boards: Taiga, Wekan

Closing Thoughts

Design, develop, and execute is a loop. A well-designed script that is easy to test and run will save time and reduce surprises. Use the rich open source ecosystem to your advantage, apply software engineering discipline to your automation code, and treat execution as a first-class engineering concern.

Send us a message using the Contact Us (left pane) or message Inder P Singh (18 years' experience in Test Automation and QA) in LinkedIn at https://www.linkedin.com/in/inderpsingh/ if you want deep-dive Test Automation and QA projects-based Training.

November 24, 2025

Python or C# for Selenium Automation: Which One Should You Pick?

Summary: Choosing a language for Selenium automation shapes speed, maintainability, and integration options. This post compares Python and C# across readability, performance, ecosystem, and real-world trade-offs to help you decide.

Python or C# for Selenium Automation: Which One Should You Pick?

When you start automating browsers—whether for testing or for automating repetitive tasks—Selenium is a go-to tool. But Selenium is only half the equation: the programming language you use determines how fast you develop, how easy the code is to maintain, and what libraries you can plug in.

Python: Fast to Write, Easy to Read

Python is famous for its simple, readable syntax. That makes it a great choice if you want to get tests running quickly or if your team includes newcomers. Scripts tend to be concise, which reduces boilerplate and speeds debugging. If you're new to Python, you can learn it from my Python Tutorials.

Python also has a huge ecosystem. Libraries like Pandas and NumPy are handy when you need to parse or analyze a lot of data. For reporting and test orchestration, Python offers many lightweight options that combine well with Selenium.

Community support is another advantage: you will find tutorials, sample code, and Stack Overflow answers for most problems you encounter.

C#: Strong Typing, Performance, Enterprise Tools

C# is a statically typed, compiled language with deep ties to the .NET platform. For larger test suites or enterprise projects, strong typing helps catch many errors at compile time rather than at runtime. That reduces a class of defects and can make long-term maintenance easier.

As a compiled language, C# often delivers better raw execution speed than interpreted languages like Python. For very large test runs or highly performance-sensitive automation, that can matter.

Development tooling is a strong point for C#. Visual Studio provides advanced debugging, refactoring, and integrated test runners such as NUnit and MSTest. If your organization already uses the Microsoft stack, C# integrates naturally with CI/CD pipelines, build servers, and enterprise practices.

Key Differences

  • Readability: Python wins for concise, beginner-friendly code.
  • Type Safety: C# uses strong typing to surface many bugs earlier.
  • Performance: C# often outperforms Python in raw speed for large suites.
  • Ecosystem: Python excels in data processing and scripting; C# excels in enterprise integration and Windows-based tooling.
  • Tooling: Visual Studio offers mature enterprise-grade tooling for C#, while Python enjoys broad IDE support (VS Code, PyCharm).
  • Learning Curve: Python typically has a gentler learning curve; C# can be more structured and disciplined for large projects.

Which One Should You Choose?

There is no single correct answer. Choose the language that best aligns with your team and goals:

  • Choose Python if you want rapid prototyping, easy-to-read scripts, or tight integration with data-analysis libraries. Python is a great pick for smaller teams or projects that prioritize developer speed and flexibility.
  • Choose C# if your project lives in a .NET ecosystem, you need strong typing and compile-time checks, or you want deep integration with enterprise tooling and Windows environments.

Both languages can drive Selenium effectively. The best decision balances team skills, project scope, and integration needs rather than headline benchmarks alone.

Send us a message using the Contact Us (left pane) or message Inder P Singh (18 years' experience in Test Automation and QA) in LinkedIn at https://www.linkedin.com/in/inderpsingh/ if you want deep-dive Test Automation and QA projects-based Training.

January 19, 2020

Python tutorial 19 | Classes and Instance Objects

This is the last tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains Python classes and Python objects. Please view the Python video tutorial 19 or read on... What is class in Python programming? A class is a template or a pattern to create objects. Python classes support object-oriented programming. A Python class has class attributes. Also, a Python class can be updated after it's definition. The objects created from a Python class are called instance objects. The Python class syntax is:

class ClassName:
  class body

In the above class format, the Python keyword class is followed by the name of the class, then a colon and then one or more Python statements. Now, let us see Python class examples.

# Python code
class Tree:
    """A class that represents a tree""" # doc string - optional
    species = 'Pine' # class attribute - data attribute
    def describe_me (self): # class attribute - class method
        return 'this is a tree'

# print the data attribute of the Tree class i.e. print 'Pine'
print (Tree.species)
# print the documentation string of the Tree class
print (Tree.__doc__)
# update the Python class (after class definition)
Tree.species = 'Aspen'
print (Tree.species)

# class instantiation i.e. create objects
tree1 = Tree()
# note that there is no need to provide the self argument when calling the class method, describe_me()
print (tree1.describe_me(), 'of species', tree1.species)
# find out if tree1 is an object of the class Tree or not
print (isinstance(tree1, Tree))

January 12, 2020

Python tutorial 18 | Dictionaries

Moving on to the next tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains the dictionary data structure. Please view the Python video tutorial 18 or read on... What is dictionary in Python programming? It is a group of key value pairs, that may be stored in any order. The Python dictionary keys can be strings or numbers (immutable data types only). Also, each dictionary key is unique. Python dictionaries are mutable, meaning that any dictionary item may be updated. In other programming languages, dictionaries may be called associative arrays. The dictionary syntax is:

{key0:value0, key1:value1,..., keyn:valuen}

In the above  dictionary format, the key value pairs are separated by commas. The first item is key0:value0, the second item is key1:value1 and so on. The entire group of key value pairs is enclosed within curly braces. Now, let us see Python dictionary examples, Python dictionary operations and Python dictionary functions.

# Python code
num_to_words = {1:'one', 2:'two', 10:'ten', 3:'three', 5:'five'}
# print the Python dictionary (the items may be in any order)
print (num_to_words)
# print the Python dictionary item's value for the given key i.e. print 'three'
print (num_to_words[3])
# modify the Python dictionary item's value for the given key
num_to_words[1] = 'unity'
# print the updated value i.e. print 'unity'
print  (num_to_words[1])

January 06, 2020

Python tutorial 17 | Tuples

Let us go to the next tutorial in the Python Tutorials for Beginners.  This Python beginner tutorial explains the tuple sequence data type. Please view Python video tutorial 17 or read on... What are tuples? In Python programming, a tuple is a sequence of items. The tuple items may be of the same data type or different data types like integers, floats, strings, lists or other tuples. The tuple items are commonly of different data types. Tuples are immutable, meaning that after a tuple is defined, no tuple item can be updated. Also, a tuple that is an item in another tuple is called a nested tuple. The tuple syntax is:
item0, item1, item2,..., itemn

The tuple syntax can also be the items within parentheses.
(item0, item1, item2,..., itemn)

In the above tuple format, the items are separated by commas. The item indexes start from 0.  Now, let us see Python tuple examples and tuple operations with Python examples.

January 01, 2020

Python tutorial 16 | Exception handling part 2 | Try except statement

Moving on with Python Tutorials for Beginners, let us go to the next one from Exception Handling part 1 tutorial. This Python beginner tutorial further explains how to handle any exception in Python. Please view the Python video tutorial 16 or read on... I have explained what are exceptions in my previous Python tutorial 15. In Python programming, the Python try statement syntax can also have an optional else clause:

try:
    try clause
except named_exception(s):
    except clause

else:
    else clause

In the above try statement format, we can put code in the else clause that will only be run when no exception is thrown in the try clause. In other words, the else clause should have code to be be run after the successful completion of the try clause. The else clause may be written after multiple excepts also. Now, let us see the else clause Python examples.

# Python code example
# This Python code, as is, should run the else clause.
try:
    i = 10 # if you comment this line, it should generate an exception and skip the else clause
    print (i*2)
except NameError:
    print ('Please define the variable first.')
else:
    print ('Printed the double of the value!')

The Python try statement syntax can also have an optional finally clause:
try:
    try clause
except named_exception(s):
    except clause

else:
    else clause
finally:
    finally clause

December 22, 2019

Python tutorial 15 | Exception handling part 1 | Try except statement

Let us go to an important tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains exceptions in Python and how to handle them. First, what are exceptions? Exceptions are the errors that are thrown during script execution. Exceptions are different from syntax errors, which are thrown before script execution. If we do not handle an exception, our script execution stops with an error message. Let us see some Python exception examples.

# Python code
print (i * 2)   # throws NameError exception because variable 'i' is not defined
int ('Hi')   # throws ValueError exception because 'Hi' is an invalid argument to the int function
print (1 / 0)   # throws ZeroDivisionError because division by zero is not allowed in Python programming

We can handle exceptions in Python using the Python try except statement. This means that we can protect our Python script from stopping abruptly. The Python try statement syntax is:
try:
    try clause
except named exception:
    except clause

In the above try statement format, the try clause is a code block with one or more statements in it. Same for the except clause. When Python runs the try clause, there are three possibilities 1), 2a) or 2b):
1) If there is no exception, the try clause is completed and the except clause is skipped.
2) If an exception is thrown in the try clause, the remaining statements in the try clause are skipped. Python matches the thrown exception with the named exception(s) after except:
2a) If the exception matches, the except clause  is run.
2b) If the exception does not match, the Python script execution stops with an error message.

Now, let us see the Python try except statement example.

# Python code example
try:
    i = 10 # comment this line to generate an exception
    print (i*2)
except NameError:
    print ('Please define the variable first.')

The Python try statement syntax can also have multiple excepts:
try:
    try clause
except named exception 1:
    except clause 1
except named exception 2:
    except clause 2
.
.
.
except named exception n:
    except clause n

In the above try statement format, there are multiple except clauses within the try statement. When Python runs the try clause there are three possibilities 1), 2a) or 2b):
1) If there is no exception, the try clause is completed and all the except clauses are skipped.
2) If an exception thrown in the try clause, the remaining statements in the try clause are skipped. Python matches the thrown exception with the named exception(s) after each except:
2a) If the exception matches any named exception, only that except clause  is run (and all the other except clauses are skipped).
2b) If the exception does not match any named exception in any except, the Python script execution stops with an error message. In order to catch any unnamed exception, we can have the last except without any named exceptions (as in the Python code examples below).

December 12, 2019

Python tutorial 14 | File handling | Working with files

Moving on to the next tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains how to work with files. Please view the Python video tutorial 14 or read on...Let us learn how to work with text files in Python programming. The syntax for opening a file with the open function is: file = open (file_name, mode)

In the above syntax, the mode is optional. If the mode is not specified or specified as 'r', the file will open in the read mode. If the mode is specified as 'a', the file will open in the append mode (meaning we can add text after existing text in the file). If the mode is specified as 'r+', the file will open in the read-write mode (meaning that we can read from the file and write to it). If the mode is specified as 'w', the file will open in the write mode (meaning that the existing text will be erased, so we have to backup the text and be careful).

Now, let us see the file functions' syntax.
file_name.read (n bytes) - read n bytes from the file into the memory
file_name.read() - read the whole file into the memory
file_name.readline() - read one line from the file
file_name.readlines() - read all lines from the file into a list
file_name.write (string) - write a string to the file (and return the number of characters written)
file.close - close the file (end the system connection to the file)

Now, let us see Python examples of file functions.

December 01, 2019

Python tutorial 13 | List functions

Moving on to the next tutorial in Python Tutorials for Beginners. This Python beginner tutorial is the next part of the Python tutorial 12 | Lists. This tutorial explains many Python list functions with examples. Please view the Python video tutorial 12 and Python video tutorial 13. Or read on...

Let us learn about list functions in Python programming with code examples. The Python list functions are explained as comments (starting with the # symbol in the Python code below). These list functions work on Python lists with different data types (integers, floats or strings), as appropriate.

# Python code examples
# create a list of strings
vowels = ['a', 'e', 'i', 'o', 'u']

# len function returns the number of items in a Python list
# print 5, which is the number of items in the vowels list
print (len(vowels))

# min function returns the smallest item in a Python list
# print 'a', which is the smallest item in the list
print (min(vowels))

# max function returns the largest item in a Python list
# print 'u', which is the largest item in the list
print (max(vowels))

# index list function returns the index of a specific item in a list; indexes start from 0
# print 1, which is the index of item, 'e' in the list
print (vowels.index('e'))

# count list function returns the number of occurrences of a specific item in a list
# print 1, which is the number of times 'i' appears in the list
print (vowels.count('i'))


November 24, 2019

Python tutorial 12 | Lists

Let us move to the next tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains lists in Python. The tutorial also shows a variety of operations that we can do on Python lists.

What are lists? In Python programming, a list is a group of values. These values are called items. The items are commonly of the same data type like all integers or all floats. But, it is possible for the items to be of different list data types like strings, integers or floats. Lists are mutable, meaning that we can change a list. A list may have another list as an item. The lists which are items of another list are called nested lists. The list syntax is:

[item0, item1, item2,..., itemn]

In the above list format, note that the list is put between square brackets [ and ]. Within the list, the items are separated by commas. The item indexes start from 0. Now, let us see Python list examples and list operations with Python examples.

November 10, 2019

Python tutorial 11 | user defined functions

Moving on with Python Tutorials for Beginners. This Python beginner tutorial explains how to write user-defined functions in Python programming with examples. Please view the Python video tutorial 11 or read on...

Functions allow us to avoid code repetition. We already know about string functions like lower, upper and capitalize and math functions like ceil, floor and trunc. We can define our own functions (called user-defined functions) in Python programming language.

A Python user defined function may have one or more parameters. The function parameters provide data to the function code. The function may produce different outputs based on the parameter values it receives in the function call. A Python user-defined functions may have documentation that explains it. The function definition syntax is:

def function_name (parameters):
    doc string
    code block
    return return_value

Note the def keyword that we use to define the function. The parameters are optional. The function body has the documentation string (the doc string), code block and the return statement. Now, let us see Python function examples.

November 03, 2019

Python tutorial 10 | numeric operations and functions

Moving on with Python Tutorials for Beginners. This Python beginner tutorial explains the useful Python numeric operations and functions with examples. It also explains how to import modules in our code. Please view the Python video tutorial 10 or read on...

First, let us see Python examples of numeric operations in Python programming.

# Python code example
i = -10
# print absolute value of i, which is 10
print (abs(i))

# use max numeric operation
# print the maximum value from a number of values, which is 100
print (max(-1, 100, 2.3, 4, 90))

# use min numeric operation
# print the minimum value from a number of values, which is -1
print (min(-1, 100, 2.3, 4, 90))

# use round numeric operation
a = 1.234
# print the float value rounded off to the nearest integer value
print (round(a))
# print the float value rounded off to 2 decimal places
print (round(a, 2))

October 28, 2019

Python tutorial 9 | string methods

Let us continue with Python Tutorials for Beginners. If you are new to Python strings, please see my Python tutorial 2 | Handling Strings first. This Python beginner tutorial explains many useful Python string functions with examples. Please view the Python video tutorial 9 or read on...

Now let us see Python examples of string methods in Python programming.

# Python code example
greeting = "Hello"

# print in lower case
print (greeting.lower())

# print in upper case
print (greeting.upper())

name = 'john doe'
# print only the first character in capitals with capitalize
print (name.capitalize())

# print the first character capitalized in every word with title
print (name.title())

# Python code example
some_string = "   this is some text   "
# strip the left hand side spaces with lstrip
print (some_string.lstrip())
# strip the given left hand side characters i.e. spaces, t and h with lstrip
print (some_string.lstrip(' th'))
# strip the right hand side spaces with rstrip
print (some_string.rstrip())
# strip the given right hand side characters i.e. t and spaces with rstrip
print (some_string.rstrip('t '))
# strip spaces on both ends with strip
print (some_string.strip())

October 13, 2019

Python tutorial 8 | for loop statement

This is the next of Python Tutorials for Beginners. Please view all the Python tutorials in this blog here. This Python beginner tutorial explains the for statement in Python with multiple examples. The Python for statement loops over items of any sequence like an integer series or a list. Please view the Python video tutorial 8 or read on...

In Python programming, it is simple to create the sequence of integers that you need by using the range function. You can use the continue statement or break statement in the for loop. As in the while loop, the continue statement skips the current iteration of the for loop. The break statement ends the for loop immediately.

The for statements in Python programming have the Python for loop syntax below. The variable is assigned the first value in the sequence and the code block1 (for block) is run. Then the variable is assigned the second value in the sequence and the code block1 is run again. This goes on until the sequence is complete. Then the code block2 (else block) is run once and the entire for loop statement ends. Note that the else part of the for statement is optional.

for variable(s) in sequence:
    code block1
else:
    code block2

Now, let us see Python examples of Python for loop programs.

# Python code example
# print integers from range(6) i.e. 0 through 5
# i is the Python for loop index
for i in range (6):
    print (i)
else:
    print ('End of Python for statement')

# Python code example
# print integers from the range(6) but exclude 3 i.e. 0, 1, 2, 4, 5
for i in range (6):
    if i == 3:
        continue # skip current iteration of the loop
    print (i)
else:
    print ('End of for statement')

# Python code example
# print integers from the range(6) but up to 2 i.e. 0, 1, 2
for i in range (6):
    if i == 3:
        # terminate the for loop immediately
        # even the else block (code block2) is not run
        break
    print (i)
else:
    print ('End of for statement')

October 06, 2019

Python tutorial 7 | while statement

This is the next of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains the while statement in Python with multiple examples. The while statement repeats execution of a code block for as long as a condition is True. Please view the Python video tutorial 7 or read on...

The while statements in Python programming have two formats, the while statement and the while else statement. Now, let us see these formats with Python examples. Note : the formats are followed by Python samples

In the first format of Python while statement, the condition is evaluated. If the condition is True, the code block is run. Again, the condition is evaluated. If the condition is still True, the code block is run again. This goes on until the condition becomes False (by some code in the code block). The while statement ends when the condition becomes False.

while condition:
    code block

# Python code example
# print integers from 1 to 5
i = 1
while i <= 5:
    print (i)
    i = i + 1 # add 1 to the value of i and assign it back to i (in other words, increase i's value by 1)

September 29, 2019

Python tutorial 6 | if statement

This is the sixth of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains the if statement in Python with multiple examples. You can use the if statement to run a block of code depending on a condition. You can write a Python condition using Python comparison operators or Python logical operators. Please view the Python video tutorial 6 or read on...

In Python programming language, the block of code is formed by indenting it by a few spaces, typically 4 spaces. The if statements in Python programming have three formats, the if statement, the if else statement and the if elif else statement. Now let us see these formats with Python examples.

Note : the formats are followed by Python samples

In the first format, the condition is evaluated. If the condition is True, then the code block is run by Python. If the condition is False, nothing happens.

if condition:
    code block

# Python code example
# input function request a string from the user
name = input('Enter a name : ')
# len function returns the length of the string, name
if len(name) > 5:
    print(name, ' has the length', len(name))

September 22, 2019

Python tutorial 5 | Logical Operators

This is the fifth of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains logical operations in Python with examples. It also shows operator precedence within logical operators and between Python comparison operators and Python logical operators. Please view the Python video tutorial 5 or read on...

Python programming language has three logical operators. The logical operators in Python are not operator, and operator and or operator. Now, there are two Boolean values, which are True and False.

The not operator results in the other Boolean value. If a condition is True, the not operator converts it to False. If the condition is False, the not operator converts it to True. The and operator needs two conditions. If both the conditions are True, the and operator gives the result as True. Else, the and operator gives the result as False. The or operator also needs two conditions. If both the conditions are False, the or operator gives the result as False. Else, the or operator gives the result as True. If a logical expression has multiple operators, the Python logical operators have different operator precedence. The not operator has the highest priority, then the and operator and finally, the or operator.

Now, let us see these logical operators with examples.

September 15, 2019

Python tutorial 4 | Comparison Operators

This is the fourth of Python Tutorials for Beginners. You can see all the Python tutorials in this blog here. This Python beginner tutorial explains comparison operations in Python programming with multiple examples. Please view my Python video tutorial 4 or read on...

You can use Python comparison operators when you write conditions in Python if statement or Python while loop statement. In Python programming language, the comparison operators include equal to, not equal to, less than, less than or equal to, greater than and greater than or equal to. The result of any Python comparison operation is a True or False value.

A single Python condition may contain different comparison operators but all comparison operators in Python have the same priority. This means that there is no operator precedence.
Now, let us see these comparison operators with examples.

September 09, 2019

Python tutorial 3 | Arithmetic Operators

This is the third of Python Tutorials for Beginners. In order to get started, you can see Python Tutorial 1 | Introduction and Python tutorial 2 | Handling Strings. Let us learn about arithmetic operators in Python programming language. This tutorial explains the arithmetic operators in Python programming. Please view my Python video tutorial 3 or read on...

What is an operator? It is a construct for processing one or more data values. In Python programming language, an operator is shown by a special character or a keyword.

There are several arithmetic operators in Python. These are + for addition, - for subtraction, * for multiplication, / for division, // for floor division or integer division, % for remainder of integer division and ** for power. Now, let us see examples of integer add, float add, integer subtract, float subtract, integer multiply, float multiply, division, floor division, remainder and power arithmetic operations in Python.

September 01, 2019

Python tutorial 2 | Handling Strings

This is the second of Python Tutorials for Beginners. In order to get started, please first see the Python Tutorial 1 | Introduction. Let us learn how to handle strings in Python programming language. Please view my Python video tutorial 2 or read on...

A string is a sequence of characters. A string is enclosed by single quotes or double quotes. A multi-line string is enclosed by triple quotes (either both single quotes or both double quotes). You can see your string by using the print function. The print function omits enclosing quotes. The + Python string operator concatenates (combines) strings. The * Python string operator repeats a string a number of times. You can assign multiple variables in a single Python statement. Using indexing, you can extract a single character from a string. Using slicing, you can extract any part of a string. Strings in Python programming language are immutable. This means that once you define a string, you cannot change it. Now, let us see examples of these concepts.