Sunday, 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.

Sunday, November 17, 2019

Testim Dev Kit Beta Program Invitation

As you may know, Testim is an automated functional testing tool. Testim uses Artificial Intelligence (AI) for the authoring, execution and maintenance of automated tests. Earlier, we could record automated tests in Testim. But now, we can also write, debug and run test automation in Testim IDE using JavaScript programming. Additionally, we can record automated tests and export to code for automated testing. The Testim Development Kit (TDK) provides APIs and example code to write automated tests using JavaScript quickly. You can see more information about the TDK and join the beta program here now.

Now, Testim’s end-to-end software test automation delivers the speed and stability of AI-based codeless tests, with the power of code. We get the flexibility to record or code tests, run on 3rd-party grids, fit our workflow and tools including CI, Git and more. If you are interested, you can join Dev Kit beta now. Thank you.

Sunday, 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.

Sunday, November 3, 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))