2.2.1.1 Python literals Public

2.2.1.1 Python literals

David Khieu
Course by David Khieu, updated more than 1 year ago Contributors

Description

Literals - the data in itself Now that you have a little knowledge of some of the powerful features offered by the print() function, it's time to learn about some new issues, and one important new term - the literal.

Module Information

Description

Literals - the data in itself Now that you have a little knowledge of some of the powerful features offered by the print() function, it's time to learn about some new issues, and one important new term - the literal.
No tags specified
Literals - the data in itself Now that you have a little knowledge of some of the powerful features offered by the print() function, it's time to learn about some new issues, and one important new term - the literal.  A literal is data whose values are determined by the literal itself.  As this is a difficult concept to understand, a good example may be helpful.  Take a look at the following set of digits:  123 Can you guess what value it represents? Of course you can - it's one hundred twenty three But what about this:  c Does it represent any value? Maybe. It can be the symbol of light, for example. It also can be the constant of integration. Or even the length of a hypotenuse in the sense of a Pythagorean theorem. There are many possibilities.  You cannot choose the right one without some additional knowledge.  And this is the clure: 123 is a literal, and c is not.  You use literals to encode data and to put them into your code.  We're now going to show you some conventions you have to obery when using Python.
Show less

Description

Literals - the data in itself 2
No tags specified
Literals - the data in itself Let's start with a simple experiment - take a look at the snippet in the editor.  The first line looks familiar. The second seems to be erroneous due to the visible lack of quotes.  If everything went okay, you should now see two identical lines.  What happened?> What does it mean?  Through this example, you encounter two different types of literals:  a string, which you already know.  and an integer number, something completely new.  The print() function presents them in exactly the same way - this example is obvious, as their human-readable representation is also the same.  Internally, in the computer's memory, these two values stored in completely different ways - the string exists as just a string - a series of letters.  The numbers converted in machine representation (a set of bits). The print() function is able to show them both i a form readable to humans.  We're now going to be spending some time discussing numeric literals and their internal life.
Show less

Description

Integers
No tags specified
Integers You may already know a little about how computers perform calculations on numbers. Perhaps you've heard of the  binary system, and know that it's the system computers use for storing numbers, and that they can perform any operation upon them.  We won't explore the intricacies of positional numeral systems here, but we'll say that the numbers handled by modern computers are two types:  Integers, that is, those which are devoid of the fractional part and floating-point numbers (or simply floats), that contain (or are able to contain) the fractional part.  This definition is not entirely accurate, but quite sufficient for now. The distinction is very important, and the boundary between these two types of numbers is very strict. Both of these kinds of numbers differ significantly in how they're stored in a computer memory and in the range of acceptable values.  The characteristic of the numeric value which determines its kind, range, and application, is called the type. If you encode a literal and place it inside Python code, the form of the literal determines the representation (type) Python will use to store it in the memory.  For now, let's leave the floating-point numbers aside (we'll come back to them soon) and consider the question of how Python recognizes integers.  The process is almost like how you would write them with a pencil on paper - it's simply a string of digits that make up the number. But there's a reservation - you must not interject any characters that are not digits inside the number.  Take, for example, the number eleven million one hundred and eleven thousand one hundred and eleven. If you took a pencil in your hand right now, you would write the number like this: 11, 111,111, or like this: 11.111.111, or even like this: 11 111 111 .  It's clear that this provision makes it easier to read, especially when the number consists of many digits. However, Python doesn't accept things like these. It's prohibited. What Python does allow, though, is the use of underscores in numeric literals. * Therefore, you can write this number either like this: 11111111, or like that: 11_111_111.  NOTE   *Python 3.6 has introduced underscores in numeric literals, allowing for placing single underscores between digits and after base specifiers for improved readability. This feature is not available in older versions of Python.  And how do we code negative numbers in Python? As usual - by adding a minus. You can write -11111111 or -11_111_111. Positive numbers do not need to be preceded by the plus sign, but it's permissible, if you wish to do it. The following lines describe the same number: +11111111 and 11111111.
Show less

Description

Integers: octal and hexadecimal numbers
No tags specified
Integers: octal and hexadecimal numbers There are two additional conventions in Python that are unknown to the world of mathematics. The first allows us to use numbers in an octal representation.  If an integer number is preceded by an 0o or 0O prefix (zero-o), it will be treated as an octal value. This means that the number must contain digits taken from the [0..7] range only.  0o123 is an octal number with a (decimal) value equal to 83. The print() function does this conversion automatically. Try this:  print(0o123) The second convention allows us to use hexadecimal number. Such numbers should be preceded by the prefix 0x or 0X (zero-x) 0x123 is a hexadecimal number with a (decimal) value equal to 291. The print() function can manage these values too. Try this:  print(0x123)
Show less

Description

Floats
No tags specified
Floats Now it's time to talk about another type, which is designed to represent and to store the numbers that (as a mathematician would say) have a non-empty decimal fraction.  They are the numbers that have (or may have) a fractional part after the decimal point, and although such a definition is very poor, it's certainly sufficient for what we wish to discuss.  Whenever we use a term like two and a half  or minus zero point four,  we think of numbers which the computer considers floating-point numbers: 2.5 -0.4 Note: two and a half looks normal when you write it in a program, although if your native language prefers to use a comma instead of a point in the number, you should ensure that your number doesn't contain any commas at all.  Python will not accept that, or (in very rare but possible cases) may misunderstand your intentions, as the comma itself has it's own reserved meaning in Python.  If you want to use just a value of two and a half, you should write it as shown above. Note once again - there is a point between 2 and 5 - not a comma.  As you can probably imagine, the value of zero point four could be written in Python as:  0.4 But don't forget this simple rule - you can omit zero when it is the only digit in front of or after the decimal point.    In essence, you can write the value 0.4 as:  .4 This will change neither its type nor its value.
Show less

Description

Ints vs. floats
No tags specified
Ints vs. floats The decimal point is essentially important in recognizing floating-point numbers in Python.  Look at these two numbers:  4 4.0 You may think they are exactly the same, but Python sees them in a completely different way.  4 is an integer number, whereas 4.0 is a floating-point number.  The point is what makes a float.  On the other hand, it's not only points that make a float. You can also use the letter e.  When you want to use any numbers that are very large or very small, you can use scientific notation.  Take, for example, the speed of light, expressed in meters per second. Written directly it would look like this: 300000000 to avoid writing out so many zeros, physics textbooks use an abbreviated form, which you have probably already seen: 3 x 10^8 It reads: three times ten to the power of eight.  IN Python, the same effect is achieved in a slightly different way - take a look:  3E8 The letter E (you can also use the lower-case e - it comes from the word exponent) is a concise record of the phrase times ten to the power of.  Note:  the exponent (the value after the E) has to be an integer the base (the value in front of the E) may be an integer.
Show less

Description

Coding floats
No tags specified
Coding Floats Let's see how this convention is used to record numbers that are very small (in sense of their absolute value, which is close to zero).  A physical constant called Planck's constant (and denoted as H) according to the textbooks, has the value of: 6.62607 x 10^-34. If you would like to use it in a program, you should write it this way:  6.62607E-34 Note: the fact that you've chosen one of the possible forms of coding float values doesn't mean that Python will present it the same way.  Python may sometimes choose different notation than you.  For example, let's say you've decided to use the following float literal:  0.000000000000000000000001 When you run this literal through Python:  Print(0.00000000000000001) This is the result:  1e-22 Python always chooses the more economical form of the number's presentation, and you should take this into consideration when creating literals.
Show less

Description

Strings
No tags specified
Strings Strings are used when you need to process text (like names of all kinds, addresses, novels, etc.), not numbers. You already know a bit about them, e.g., that strings need quotes the way floats need points.  This is a very typical string: "I am a string." However, there is a a catch. The catch is how to encode a quote inside a string which is already delimited by quotes.  Let's assume that we want to print a very simple message saying:  I like "Monty Python" How do we do it without generating an error? There are two possible solutions.  The first is based on the concept we already know the escape character, which you should remember is played by the backslash.  The backslash can escape quotes too. A quote preceded by a backslash changes its meaning - it's not a delimiter, but just a quote. This will work as intended:  print("I like \"Monty Python\ "") Note: you don't need to do any escaping here.
Show less

Description

Coding strings
No tags specified
Coding strings Now the next question is: how do you embed an apostrophe into a string placed between apostrophes?  You should already know the answer, or to be precise, two possible answers.  Try to print out a string containing the following message:  I'm Monty Python.  Do you know how to do it? Click Check below to see if you were right:  print('I\'m Monty Python.') or print("I'm Monty Python.") As you can see, the backslash is a very powerful tool - it can escape not only quotes, but also apostrophes.  We've shown it already, but we want to emphasize this phenomenon once more - a string can be empty - it may contain no characters at all.  An empty string still remains a string:  ' ' " "
Show less

Description

Boolean values
No tags specified
Boolean values To conclude with Python's literals, there are two additional ones.  They're not as obvious as any of the previous ones, as they're used to represent a very abstract value - truthfulness. Each time you ask Python if one number is greater than another, the question results in the creation of some specific data - a Boolean value.  The name comes from George Boole (1815-1864), the author of the fundamental work, The Laws of Thought, which contains the definition of Boolean algebra - a part of algebra which makes use of only two distinct values: True and False, denoted as 1 and 0.  A programmer writes a program, and the program asks questions. Python executes the program, and provides the answers. The program must be able to react according to the received answers.  Fortunately, computers know only two kinds of answers:  Yes, this is true No, this is false You'll never get a response like: I don't know or Probably yes, ut I don't know for sure. Python, then, is a binary reptile. These two Boolean values have strict denotiations in Python:  True False You cannot change anything - you have to take these symbols as they are, including case-sensitivity.  Challenge: What will the output of the following snippet of code?  print(True > False) print(True < False) Run the code in the Sandbo to check. Can you explain the result?
Show less

LAB

Description

LAB
No tags specified
LAB Estimated time 5-10 minutes Level of difficulty Easy Objectives becoming familiar with the print() function and its formatting capabilities practicing coding strings experimenting with Python code Scenario Write a one-line piece of code, using the print() function, as well as the newline and escape characters, to match the expected result outputted on three lines.  swiftCopy code print("I'm\n\"learning\"\n\"\"\"Python\"\"\"") Output: rustCopy code I'm "learning" """Python""" Explanation: The newline character \n is used to break the output into three lines. Double quotes " are used to enclose the strings "learning" and "Python". To include double quotes within a string, we need to escape them with a backslash \ to avoid interpreting them as the end of the string. The single quote in "I'm" is not escaped because we used double quotes to enclose the entire string.
Show less

Description

Key takeaways
No tags specified
Key takeaways Literals are notations for representing some fixed values in code. Python has various types of literals - for example, a literal can be a number (numeric literals, e.g., 123), or a string (string literals, e.g., "I am a literal.") The binary system is a system of numbers that employs 2 as the ase. Therefore, a binary number is made up of 0s and 1s only, e.g., 1010 is the 10 in decimal.  Octal and hexadecimal system numeration systems, similarly, employ 8 and 16  as their bases respectively. The hexadecimal system uses the decimal numbers and six extra letters.  Integers (Or simply ints) are one of the numerical types supported by Python. They are numbers written without a fractional component, e.t., 256 , or -1 (negative integers). Floating-point numbers (or simply floats) are another one of the numerical types supported by Python. They are numbers that contain (or are able to contain) a fractional component, e.t., 1.27.  To encode an apostrophe or a quote inside a string you can either use the escape character, e.t., 'I\'m happy. ', or open and close the string using an opposite set of symbols to the ones you wish to encode, e.g., "I'm happy." to encode a apostrophe, and 'He said "Python", not "typhoon"' to encode a double quote.  Boolean values are two constant objects True and False used to represent truth values (in numeric contexts 1 is True, while 0 is False.  EXTRA There is one more, special literal that is used in Python: the None literal. This literal is a so called NoneType object, and it is used to represent the absence of a value. We'll tell you more about it soon.  Exercise 1 What types of literals are the following two examples?  "Hello", "007" They're both strings/string literals.  Exercise 2 What types of literals are the following four examples?  "1.5", 2.0, 528, False String, numerical literal (a float), the third is a numerical literal (an integer) and the fourth is a boolean literal.  Exercise 3 What is the decimal value of the following binary number?  1011 It's 11, because (2**0) +(2**1) + (2**3)=11
Show less

Description

Python as a calculator Now, we're going to show you a completely new side of the print() function. You already know that the function is able to show you the values of the literals passed to it by arguments.
No tags specified
Python as a calculator Now, we're going to show you a completely new side of the print() function. You already know that the function is able to show you the values of the literals passed to it by arguments.  In fact, it can do something more. Take a look at the snippet: print(2+2) Retype the code in the editor and run it. Can you guess the output 4 You should see the number four (4). Feel free to experiment with other operators.  Without taking this too seriously, you've just discovered that Python can be used as a calculator. Not a very handy one, and definitely not a pocket one, but a calculator nonetheless.  Taking it more seriously, we are now entering the province of operators and expressions. Basic operators An operator is a symbol of the programming language, which is able to operate on the values.  For example, just as in arithmetic, the + (Plus) sign is the operator which is able to add two numbers, giving the result of the addition.  Not all Python operators are as obvious as the plus sign, though, so let's go through some of the operators available in Python, and we'll explain which rules govern their use, and how to interpret the operations they perform. We'll begin with the operators which are associated with the most widely recognizable arithmetic operations:  + , - , * , / , // , % , ** The order of their appearance is not accidental. We'll talk more about it once we've gone through them all.  Remember: Data and operators when connected together form expressions. The simplest expression is a literal itself.
Show less

Description

Arithmetic operators: exponentiation
No tags specified
Arithmetic operators: exponentiation  a ** (double asterisk) sign is an exponentiation (power) operator. Its left argument is the  base, its right, the exponent. Classical mathematics prefers notation with superscripts, just like this: 2^3. Pure text editors don't accept that, so Python uses ** instead, e.g. 2**3 Take a look at our examples in the editor window.  print(2 ** 3) print(2 ** 3.) print(2. ** 3) print(2. ** 3.) Note: we've surrounded the double asterisks with spaces in our examples. It's not compulsory, but it improves the readability of the code.  The examples show a very important feature of virtually all Python  Numerical Operators. Run the code and look carefully at the results it products. Can you see any regularity here? Remember: It's possible to formulate the following rules based on this result:  when both ** arguments are integers, the result is an integer, too when at least one ** argument is a float, the result is a float. too This is an important distinction to remember.
Show less

Description

Arithmetic operators: multiplication and division
No tags specified
Arithmetic operators: multiplication An * (asterisk) sign is a multiplication operator.  Run the code below and check if our integer vs. float rule is still working.  print(2*3) print(2*3.) print(2.*3) print(2.*3.) It is. Arithmetic operators: division a / (slash) sign is a divisional operator. The value in front of the slash is a dividend, the value behind the slash, a divisor. Run the code below and analyze the results.  print(6 / 3) print(6 / 3.) print(6. / 3) print(6. / 3.) You should see there is an exception to the rule.  The result produced by the division operator is always a float, regardless of whether or not the result seems to be a float at first glance: 1 / 2, or if it looks like a pure integer: 2/1  It this a problem? Yes, ti is. It happens sometimes that you really need a division that provides an integer value not a float.  Fortunately , PYthon can help you with that.
Show less

Description

Arithmetic operators: integer division
No tags specified
Arithmetic operators: integer division A // (double slash) sign is an integer divisional operator. It differs from the standard / operator in two details: its result lacks the fractional part- it's absent (for integers), or is always equal to zero (for floats); this means the results are always rounded.  It conforms to the integer vs. float rule. Run the example below and see the results:   print(6 // 3) print(6 // 3.) print(6. // 3) print(6. // 3.) As you can see, integer by integer division gives an integer result. All other cases produce floats. Let's do some more advanced tests.  Looks at the following snippet: print(6 // 4) print(6. // 4) Imagine that we used / instead of // - could you predict the results?  Yes, it would be 1.5 in both cases. That's clear. But what results should we expect with // division?  Run the code and see for yourself. 1 1.0 What we get is two ones - one integer and one float.  The result of integer division is always rounded to the nearest integer value that is less than the real (not rounded) result. This is very important: rounding always goes to the lesser integer.  Look at the code below and try to predict the results once again:  print(-6 // 4) print(6. // -4) -2 -2.0 Note: some of the values are negative. This will obviously affect the result. But how?  The Result is two negative twos. The real (not rounded) result is -1.5 in both cases. However, the results are the subjects of rounding. The rounding goes toward the lesser of the integer value,  and the lesser integer value is -2, hence:  -2 and -2.0 NOTE:  Integer division can also be called floor division. You will defintely come across this term in the future.
Show less

Description

Operators: remainder (modulo)
No tags specified
Operators: remainder (modulo) The next operator is quote a peculiar one, because it has no equivalent among traditional arithmetic operators.  Its graphical representation is Python is the % (percent) sign, which may look a bit confusing.  Try to think of it as a slash (division operator) accompanied by two funny circles.  The result of the operator is a remainder left after the integer division.  In other words, it's the value left over after dividing one value by another to produce an integer quotient.  Note: the operator is sometimes called modulo in other programming languages.  Take a look at the snippet - try to predict its result and then run it:  print(14%4) As you can see, the result is two. 2 This is why: 14//4 gives 3 -> this is the integer quotient 3*4 gives 12 -> as a result of quotient and divisor multiplication 14-12 gives 2 -> this is the remainder This example is somewhat more complicated:  print(12 % 4.5) What is ther result?  3.0 - not 3 but 3.0 (the rule still works: 12 // 4.5 gives 2.0; 2.0 * 4.5 gives 9.0; 12 - 9.0 gives 3.0) Operators: how not to divide As you probably know, division by zero doesn't work.  Do not try to;  perform a division by zero perform an integer division by zero find a remainder of a division by zero
Show less

Description

Operators: addition and subtraction
No tags specified
Operators: addition The addition operator is the+ (plus)  sign, which is fully in line with mathematical standards.  Again, take a look at the snippet of the program below:    print(-4 + 4) print(-4. + 8) The result should be nothing surprising. Run the code to check it.  0 4.0 The subtraction operator, unary and binary operators The subtraction operator is obviously the - (minus) sign, although you should note that this operator has another meaning - it can change the sign of a number. This is a great opportunity to present a very important distinction between unary and binary operators.  In subtracting applications, the minus operator expects two arguments: the left (a minuend in arithmetical terms) and right (a subtrahend). For this reason, the subtraction operator is considered to be one of the binary operators, just like the addition multiplication and division operators.  But the minus operator may be used in a different (unary) way - take a look at the last line of snippet below:    print(-4 - 4) print(4. - 8) print(-1.1) By the way: there is also a unary + operator, You can use it like this:  print(+2) The operator preserves the sign of its only argument - the right one. Although such a construction is syntactically correct, using it doesn't make much sense, and it would be hard to find a good rationale for doing so.  Take a look at the snippet abor - can you guess its output?
Show less

Description

Operators and their priorities
No tags specified
Operators and their priorities So far, we've treated each operator as if it had no connection with the others. Obviously, sich an ideal and simple situation is a rarity in real programming.  Also, you will very often find more than one operator in one expression, and then this presumption is no longer so obvious.  Consider the following expression:  2+3*5 You probably remember from school that Multiplications preed additions.  You surely remember that you should first multiply 3 by 5 and, keeping the 15 in your memory, then add it to 2, thus getting the result of 17.  The phenomenon that causes some operators to act before others is known as the hierarchy of priorities.  Python precisely defines the priorities of all operators, and assumes that operators of a larger (higher) priority perform their operations before the operators of a lower priority.  So, if you know that * has a higher priority that +, the computation of the final result should be obvious.  Operators and their bindings The binding of the operator determines the order of computations performed by some operators with equal priority, put side by side in one expression.  Most of Python's operators have left-sided binding, which means that the calculation of the expression is conducted from left to right.  This simple example will show you how it works. Take a look: print(9 % 6 % 2) There are two possible ways of evaluating this expression:  from left to right: first 9%6 gives 3, then then 3%2 gives 1 from right to left: first 6%2 gives 0, then 9%0 causes a fatal error.  Run the example and see what you get.  The result should be 1. This operator has left-sided binding. But there's one interesting exception.
Show less

Description

Operators and their bindings: exponentiation
No tags specified
Operators and their bindings: exponentiation Repeat the experiment, but now with exponentiation.  Use this snippet of code: print(2 ** 2 ** 3) The two possible results are:  2**2 ->4; 4**3->64 2**3->8; 2***->256 run the code. What do you see?  The result clearly shows that the exponentiation operator uses right-sided binding.
Show less

Description

List of priorities, Operators and parentheses
No tags specified
List of priorities Since you're new to Python operators, we don't want to present the complete list of operator priorities right now.  Instead, we'll show you a truncated form, and we'll expand it consistently as we introduce new operators.  Look at the table below:  Priority      Operator         **        +, - (note: unary operators located next to the right of the power operator bind more strongly)   unary        *, / , // , %        +, -                                                                                                                                                                      binary Note: we've enumerated the operators in order from highest (1) to the lowest (4) priorities.  Try to work through the following expression:  print(2 * 3 % 5) Both operators (* and %) have the same priority, so the result can be guessed only when you know the binding direction. What do you think? What is the result?  1 Operators and parentheses Of course, you're always allowed to use parentheses, which can change the natural order of calculation.  In accordance with the arithmetic rules, subexpressions in parentheses are always calculated first.  You can use as many parentheses as you need, and they're often used to improve the readability of an expression, even if they don't change the order of the operations.  An example of an expression with multiple parentheses is here: print((5 * ((25 % 13) + 100) / (2 * 13)) // 2) Try to compute the value that's printed to the console. What's the result of the print() function  10.0
Show less

Description

Key Takeaways
No tags specified
Key Takeaways An Expression is a combination of values (or variable, operators, calls to functions - you will learn about them soon) which evaluates to a certain value, e.g., 1 + 2   Operators are special symbols or keywords which are able to operate on the values and perform (mathematical) operations, e.g., the * operator multiplies tow values: x * y  Arithmetic operators in Python: + (addition), - (subtraction), * (multiplication), / (classic division - always returns a float), % (modulus - divides left operand by right operand and returns the remainder of the operation, e.g., 5 % 2 = 1 ), ** (exponentiation - left operand raised to the power of right operand, e.g.d, 2 ** 3 = 2 * 2 * 2 = 8). // (floor/integer division - returns a number resulting from division - returns a number resulting from division, but rounded down to the nearest whole number, e.g., 3 ?? 2.0 = 1.0) a unary operator is an operator with only one operand, e.g., -1, or +3 A binary operator is an operator with tow operands, e.g., 4 + 5, or 12 % 5 Some operators act before others - the hierarchy of priorities: ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​the ** operator (exponentiation) has the highest priority; then the unary + and - (note: a unary operator to the right of the exponentiation operator binds more strongly, for example: 4 ** -1 equals 0.25 then *, /, //, and % and, finally the lowest priority: the binary + and - Subexpressions in parentheses are always calculated first, e.g., 15 -1 * (5 * (1 + 2)) = 0 The exponentiation operator uses right-sided binding, e.g., 2 ** 2 ** 3 = 256 ​​​​​​​Exercise 1 What is the output of the following snippet?  print((2 ** 4), (2 * 4.), (2 * 4)) 16 8.0 8 Exercise 2 What is the output of the following snippet?  print((-2 /4), (2 / 4), (2 // 4), (-2 //4)) -0.5 0.5​ 0 -1 Exercise 3 What is the output of this snippet? print((2 % -4), (2 % 4), (2 ** 3 ** 2)) ​​​​​-2 2 512
Show less
No tags specified
What are variables?  It seems fairly obvious that Python should allow you encode literals carrying number and text values. You already know that you can do some arithmetic operations with these numbers: add, subtract, etc. You'll be doing that many times. But it's quite a normal question to ask how to store the results of these operations, in order to use them in other operations, and so on. How do you save the intermediate results, and use them again to produce subsequent ones?  Python will help you with that. It offers special "boxes" (containers) for that purpose, and these boxes are called variables - the name itself suggests that the content of these containers can be varied in (almost) any way.  What does every Python variable have?  a name a value (the content of the container) Let's start with the issues related to a variable's name.  Variables do not appear in a program automatically. As developer, you must decide how many and which variables to use in your programs.  You must also name them.  If you want to give a name to a variable,  you must follow some strict rules: the name of the variable must be composed of upper-case or lower-case letters, digits, and the character _ (underscore) the name of the variable must begin with a letter the underscore character is a letter upper- and lower-case letters are treated as different (a little differently than in the real world - Alice and ALICE are the same first names, but in Python they are two different variable names, and consequently, two different variables the name of the variable must not be any of Python's reserved words (the keywords - we'll explain more about this soon).
Show less
No tags specified
Correct and incorrect variable names Note that the same restrictions apply to function names.  Python does not impose restrictions on the length of variable names, but that doesn't mean that a long variable name is always better than a short one.
Show less
Show full summary Hide full summary