GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — learn-python/src/getting_started/test_variables.py at master · andy-github-info/learn-python Expand file tree/ Copy pathtest_variables.pyMore file actions 38 lines (27 loc) · 1.28 KB / Copy pathtest_variables.pyFile metadata and controls38 lines (27 loc) · 1.28 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 """Variables @see: https://docs.python.org/3/tutorial/introduction.html @see: https://www.w3schools.com/python/python_variables.asp @see: https://www.learnpython.org/en/Variables_and_Types Python is completely object oriented, and not "statically typed". You do not need to declare variables before using them, or declare their type. Every variable in Python is an object. Unlike other programming languages, Python has no command for declaring a variable. A variable is created the moment you first assign a value to it. A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for Python variables: - A variable name must start with a letter or the underscore character. - A variable name cannot start with a number. - A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ). - Variable names are case-sensitive (age, Age and AGE are three different variables). """ def test_variables(): """Test variables""" integer_variable = 5 string_variable = 'John' assert integer_variable == 5 assert string_variable == 'John' variable_with_changed_type = 4 # x is of type int variable_with_changed_type = 'Sally' # x is now of type str assert variable_with_changed_type == 'Sally' |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |