Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.

Slides:



Advertisements
Similar presentations
CS 100: Roadmap to Computing Fall 2014 Lecture 0.
Advertisements

String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
An Introduction to Python – Part II Dr. Nancy Warter-Perez.
Conditional Statements Introduction to Computing Science and Programming I.
Introduction to Python
Chapter 2 Writing Simple Programs
Intro to Python Paul Martin. History Designed by Guido van Rossum Goal: “Combine remarkable power with very clear syntax” Very popular in science labs.
Python Control of Flow.
Fortran- Subprograms Chapters 6, 7 in your Fortran book.
INLS 560 – V ARIABLES, E XPRESSIONS, AND S TATEMENTS Instructor: Jason Carter.
Python Programming Fundamentals
4. Python - Basic Operators
Chapter 2 Control. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. Repetition, quick overview.
CIS Computer Programming Logic
Lists in Python.
CPTR 124 Review for Test 1. Development Tools Editor Similar to a word processor Allows programmer to compose/save/edit source code Compiler/interpreter.
Programming for Engineers in Python Sawa 2015 Lecture 2: Lists and Loops 1.
If statements while loop for loop
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
Exam 1 Review Instructor – Gokcen Cilingir Cpt S 111, Sections 6-7 (Sept 19, 2011) Washington State University.
Dictionaries.   Review on for loops – nested for loops  Dictionaries (p.79 Learning Python)  Sys Module for system arguments  Reverse complementing.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
2. WRITING SIMPLE PROGRAMS Rocky K. C. Chang September 10, 2015 (Adapted from John Zelle’s slides)
Python Mini-Course University of Oklahoma Department of Psychology Day 3 – Lesson 11 Using strings and sequences 5/02/09 Python Mini-Course: Day 3 – Lesson.
Chapter 10 Loops: while and for CSC1310 Fall 2009.
1 CS 177 Week 6 Recitation Slides Review for Midterm Exam.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
PYTHON VARIABLES : CHAPTER 2 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
ITERATION. Iteration Computers are often used to automate repetitive tasks. Repeating identical or similar tasks without making errors is something that.
I NTRODUCTION TO PYTHON - GETTING STARTED ( CONT )
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Introduction to Computing Using Python Repetition: the for loop  Execution control structures  for loop – iterating over a sequence  range() function.
Computer Program Flow Control structures determine the order of instruction execution: 1. sequential, where instructions are executed in order 2. conditional,
 Python for-statements can be treated the same as for-each loops in Java Syntax: for variable in listOrstring: body statements Example) x = "string"
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
PH2150 Scientific Computing Skills Control Structures in Python In general, statements are executed sequentially, top to bottom. There are many instances.
Indentations makes the scope/block Function definition def print_message (): print “hello” Function usages print_message () hubo.move ()// hubo is a class.
Chapter 2 Writing Simple Programs
G. Pullaiah College of Engineering and Technology
Topic: Iterative Statements – Part 1 -> for loop
Python: Experiencing IDLE, writing simple programs
Computer Programming Fundamentals
CS-104 Final Exam Review Victor Norman.
Department of Computer Science,
Basic operators - strings
Selenium WebDriver Web Test Tool Training
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
Programming for Engineers in Python
Arithmetic operations, decisions and looping
Topics Introduction to File Input and Output
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
4. sequence data type Rocky K. C. Chang 16 September 2018
Test Automation For Web-Based Applications
Topics Sequences Introduction to Lists List Slicing
Introduction to Python: Day Two
Topics Sequences Lists Copying Lists Processing Lists
Python Basics with Jupyter Notebook
The structure of programming
Topics Sequences Introduction to Lists List Slicing
Test Automation For Web-Based Applications
Topics Introduction to File Input and Output
CMPT 120 Lecture 10 – Unit 2 – Cryptography and Encryption –
Selamat Datang di “Programming Essentials in Python”
Presentation transcript:

Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel

2 Day 7 Python Basics

 Memory locations reserved to store values  Variables are dynamically typed  Use the equal sign (=) to assign a value to a variable  Assign a single value to several variables simultaneously  Assign multiple values to multiple variables 3 my_variable = “hello” a = b = c = 22 name, age, height= "Bob", 22, ”5’11"

 Variable names are case-sensitive.  A variable's name can be any legal identifier (an unlimited-length sequence of Unicode letters and digits)  Must beginning with a letter or underscore  Variables that start with an underscore (_) are treated as local and private, and cannot be imported from outside the module  When choosing a name for your variables, use full words instead of cryptic abbreviations. This will make your code easier to read and understand 4

Built-in FunctionsDefinition dict(iterable)Create a new dictionary enumerate(sequence, start=0)Count and iterate through the sequence eval(expression)Compiles and immediately evaluates an expression exec(expression)This statement supports dynamic execution of Python code. float(arg), int(arg), str(arg)Return a float, integer, or string constructed from the argument hasattr(object, str_arg_name)Returns true/false whether an attribute exists in an object list(iterable)Create a new list 5 View all of the Built-in functions here:

Built-in FunctionsDefinition open(name, mode=r)Open a file print(objects, sep=' ')Print objects to the stream file range(start, stop[, step])Create lists containing arithmetic progressions reversed(seq)Return a reverse iterator. seqiterator round(number[, ndigits])Return the floating point value number rounded to ndigits digits sorted(iterable)Return a new sorted list from the items in iterable. zip([iterable, iterable,…])This function returns a list of tuples (2 or more dimensional list) 6 View all of the Built-in functions here:

 Can be concatenated: ◦ "My name is " + "Jane" ◦ "My name is " + name  Can be indexed: ◦ name = "John” ◦ name[2]  "h"  Can be sliced: ◦ name = "Geraldine" ◦ name[1:4]  "era"  Can be measured: ◦ name = "Geraldine" ◦ len(name)  9 7  Can be formatted: ◦ name = "JoHn" ◦ name.lower()  "john" ◦ name.upper()  "JOHN" ◦ name.title()  "John”  Can be repeated: ◦ name = "Bob" ◦ name*3  "BobBobBob"  Can be reversed: ◦ name = "Geraldine" ◦ name[::-1]  "enidlareG

 Easy to create: ◦ my_list = [1,2,3] ◦ names = ["Bob", "Eva"]  Can be combined: ◦ a, b = [1, 2], [6, 7] ◦ a + b  [1, 2, 6, 7]  Can be indexed: ◦ names = ["Bob", "Eva"] ◦ names[1]  "Eva"  Can be sliced: ◦ my_list = [1,2,3,4,5] ◦ my_list[1:4:2]  [2,4] 8  Can be sorted: ◦ list = [4,2,6,8,3] ◦ list.sort()  [2,3,4,6,8]  Can be repeated: ◦ list = [1,2,3] ◦ list*2  [1,2,3,1,2,3]  Can be measured: ◦ list = ["a","b","c"] ◦ len(list)  3  Can be reversed: ◦ list = [1,2,3,4] ◦ list[::-1]  [4,3,2,1]

 IF ◦ x = 4 ◦ if x > 0: print("yes")  IF / ELSE ◦ x = 4 ◦ if x > 0: print("yes") ◦ else: print("no") 9  Conditional assignment ◦ age = 12 ◦ name = "Bob" if age > 18 else "Bobby" IF / ELIF / ELSE x = 4 if x > 2: print("yes") elif x > 0: print("still yes") else: print(""no)

 Iterate through a list: list_of_items = [1,2,3,4] for item in list_of_items: print('-> ' + item)  Iterate x times: x = 4 for j in range(x): print('number:', x)  Iterate and enumerate (count): items = ["apple", "orange"] for j, item in enumerate(items): print("item {0} in an {1}".format(j+1, item)) 10 -> 1 -> 2 -> 3 -> 4 number: 0 number: 1 number: 2 number: 3 item 1 is an apple item 2 is an orange

 break: breaks out of the smallest enclosing loop for x in range(2, 6): if 8 % x == 0: print 8, 'equals', x, '*', 8/x break  continue: skips code which follows and continues with the next iteration of the loop: x = 4 for j in range(x): if x % 2 == 0: continue print x, 'is an odd number' 11 8 equals 2 * 4 3 is an odd number loop stops after x=2 print statement skipped for even numbers

 ELSE: a loop’s else clause runs when no break occurs for x in ('a', 'b', 'c', 'd'): pass else: print('loop finished') 12 loop finished PASS statement does nothing.