article ARTICLE
article4 min read

The basic concepts in Python

Literal constants: An example of literal constants is a number such as 4, 6.23, 5.25e-1 or a string like "This is a string" or "A string!". Its value is defined in a cycling way. Season 2 represents this and nothing else. It is consistent that the price of e can be changed. So, all these are referred to as literal constants.
Numbers: The Python numbers are of three types: the integers, the floating points andt he complex numbers. An integer example is 4 and is just an integer. Samples of floats are 3.23 and 52.3E-4. The E symbol indicates the power of 10. In thisc ase, the 52.3E-4 means 52.3 * 10-4. Missing numbers samples are (-3 + j) (3.3 - 2.6j).
Strings: Atoken is a sequence of characters. The strings are a bunch of words. The words can be in English or whatever language that is supported by the Unicode prototype.
There are no "ASCII-only" symbols because the Unicode standard is a superset of the ASCII. If an ASCII-encoded byte stream is required, then you should usestr.encode ("ascii"). By default, all of the strings are in the Unicode language.
You can also set strings with single quotes. For example, 'They call me Tonia and Iearn to program Pythion'. Formatting e.g. whitespace and tabs remain as it is.
Double-quote strings work exactly as they do with singles, for "How does Python look like?"
You can define multiple-triple strings with triple input ('' '). Use single quotes and double quotes freely in triple quotes.
Escape sequences: Suppose you would like a token that contains a single input. How do you set it up? For example, the cave is "I do not ignore you!". You cannot define it as 'I'm not ignorant' because Python will be confused with the beginning and the end of the string. So you have to specify separately that the introductory id does not state the end of the string. The solution is by using the so-called escape. Define the singleintroductory as \ '. For example 'I do not know!' /
Another way of defining this particular code is by using double quotes. Similarly, you need to use an escape character for a double quote within an input pipeline string. You also have to indicate the left side slash \ \.
And if you want to roll a two-line tower. One way is by using tread inserts or by using an escape character.
Raw settings: If you need to specify some strings and do not want special procedures, set a raw value or Rin the font. In this string, a new line will not be printed because there is \n why in raw strings the escape characters are not analyzed.
Immutable: This means that after you have created a string, you can not change it. Although it looks like something bad, it is not.
Contextual String Concatenation: If you place next two blocks, they are automatically joined by Python.
Note for C / C ++ developers: There is no separate char type of data in Python
Note for Perl / PHP developers: Remember that singlea nd double quotes are the same. They do not differ in any way.
Note for Regular Expression:  Always use raw strings to handle regular expressions. Otherwise, excessive use of the escape character will be required. For example, reports can be defined as' \\ 1 'or' r '\ 1'.

Groups

4
  •  Inspiring
  • comment_icon  Comment

Charilaos 24 Feb, 2019

Interesting