What I read about VBA x Python fastest work technique Memo chapter2

Variable / data type

■ Variable = something like a definition. Put frequently used items such as operations, functions, and characters in boxes (variables) and give them names so that they can be used frequently. ** Variable name restrictions ** -Characters (large and small English letters, numbers, _) symbols and spaces that can be used in variable names are not allowed ・ Numbers cannot be used as the first character of variable names (Ex str1 can be used as a variable name, but 1str cannot be used) ・ Case is distinguished ・ Reserved words cannot be used (ex if = 5)

■ Data type = For identifying data contents such as many numbers and character strings -Integer type (int) -A data type that expresses a numerical value that does not have a decimal number or less. If you add a minus, it will be a negative number, if you do not add it, it will be a correct number (ex-120, 50) -Floating point type (float) -Represents a number with a decimal point (ex 13.577, -139.85) -Pool type (bool) -Represents two values, true and false -Character string type (str) -Encloses "" and "" that express a line of one or more characters (ex'hello'" Aiueo") The program language that must be set in advance as in the above four is called ** statically typed language **.

■ Calculation operator Addition + Subtraction- Multiplication * Division / Modulo% The quotient is an integer // Exponentiation **   ■ Comparison operator x == y Returns true if x and y are equal x! = y Returns true if x and y are not equal x <y Returns true when x is less than y x <= y Returns true when x is less than or equal to y x> y Returns true when x is greater than y x> = y Returns true when x is greater than or equal to y    ■ Composite assignment operator When repeating the same process multiple times. When executing the affiliated code while increasing the variable used as a counter to count the number of times by one.    i=i+1 Normally, the above programming language is used, but In python, it can be abbreviated as i + = 1     x + = y Substitute the result of x + y into x x-= y Substitute the result of x-y into x x * = y Substitute the result of x * y for x x / = y Substitute the result of x / y into x x% = y Substitute the remainder of x% y for x

■ Logical operators x and y The logical product of x and y. Returns ture if both x and y are true x or y OR of x and y. Returns ture if either x or y is true not y Negation of x and y. false if x is true. Returns ture if false

You can also create original functions in python = definition Function definition starts with def   def Function name (** argument list **): #Be sure to add a colon # Statement Statement Statement ・ ・ return Return value # If there is no return value, omit return #

Recommended Posts

What I read about VBA x Python fastest work technique Memo chapter3
What I read about VBA x Python fastest work technique Memo chapter2
Contents of reading VBA x Python fastest work technique Memo chapter1
Excel X Python The fastest way to work
What I learned about AI / machine learning using Python (1)
What I learned about AI / machine learning using Python (3)
What I learned about AI / machine learning using Python (2)
[Python] Memo about functions
[Python] Memo about errors
[Python] Chapter 01-01 About Python (First Python)
What I learned about AI and machine learning using Python (4)
What I learned about Linux
What I learned in Python
I read "Reinforcement Learning with Python: From Introduction to Practice" Chapter 1
I read "Reinforcement Learning with Python: From Introduction to Practice" Chapter 2