Download presentation
Presentation is loading. Please wait.
1
Test Automation For Web-Based Applications
Portnov Computer School WebDriver Training Test Automation For Web-Based Applications Presenter: Ellie Skobel
2
Day 1 Python Basics
3
Variables 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 my_variable = “hello” a = b = c = 22 name, age, height= "Bob", 22, ”5’11"
4
Variable Naming 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
5
Strings Can be concatenated: Can be formatted: Can be indexed:
"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: len(name) 9 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
6
Lists Easy to create: Can be combined: Can be indexed: Can be sliced:
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[1] "Eva" Can be sliced: my_list = [1,2,3,4,5] my_list[1:4:2] [2,4] 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]
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.