Code Samples

Python

AutoIT


Python

Level: Beginner

Define Variables

programming_languages = "Python", "VB", "C++", "C#"

Print Variables

print(programming_languages)

Basic for loops + variables

for language in programming_languages:
    print(language)

Basic Functions

def FuncExample():
    i = 1
    for language in programming_languages:
        #Concatinate Strings and Integers in print statements
        print("Language " + str(i) + ":" + language)
        #Increment Integer
        i += 1

#Remember to call the function after it is declared
FuncExample()

Functions with Variables #1 – Strings

def FuncVarExample1(fname, lname):
    #Print with CRLF
    print("First Name: " + fname + "\r\n" + "Last Name: " + lname)

FuncVarExample1("Joe","Bloggs")

Functions with Variables #2 – Integers + Returning Values

def FuncVarExample2(x, y):
    #Basic integer maths
    return x+y

#Concatenating Strings and Integers
print("33 + 42 = " + str(FuncVarExample2(33,42)))

AutoIT

…check back soon…