diff options
| author | Akshita Dixit <436_bt19@iiitkalyani.ac.in> | 2022-11-13 14:26:32 +0530 | 
|---|---|---|
| committer | Akshita Dixit <436_bt19@iiitkalyani.ac.in> | 2022-11-13 14:26:32 +0530 | 
| commit | 6384e5116639993d1cc449749e5e0df4ba736fa8 (patch) | |
| tree | 2182e20675c40ea115d981c64db7ffbe3b8adead | |
| parent | 5a9b474a635a1b0b12908f8673b6f4e1e67d0812 (diff) | |
| parent | 2d59543e717f46b7defcb4b8964997f1569f78a3 (diff) | |
Merge branch 'master' of https://github.com/adambard/learnxinyminutes-docs into docker-docs
| -rw-r--r-- | fr-fr/javascript-fr.html.markdown | 2 | ||||
| -rw-r--r-- | ldpl.html.markdown | 7 | ||||
| -rw-r--r-- | markdown.html.markdown | 13 | ||||
| -rw-r--r-- | python.html.markdown | 71 | ||||
| -rw-r--r-- | rdf.html.markdown | 2 | ||||
| -rw-r--r-- | vim.html.markdown | 2 | 
6 files changed, 51 insertions, 46 deletions
| diff --git a/fr-fr/javascript-fr.html.markdown b/fr-fr/javascript-fr.html.markdown index 186859ab..308f1ca8 100644 --- a/fr-fr/javascript-fr.html.markdown +++ b/fr-fr/javascript-fr.html.markdown @@ -94,7 +94,7 @@ let banta = "Harry", santa = "Hermione";  // L'égalité est === ou ==  // === compare la valeur exacte 2 === '2' // = false -// == convertit la valeur pour comparer 2 === '2' // = true +// == convertit la valeur pour comparer 2 == '2' // = true  // En général, il vaut mieux utiliser === pour ne pas faire d'erreur.  1 === 1; // = true  2 === 1; // = false diff --git a/ldpl.html.markdown b/ldpl.html.markdown index 86603d94..449c8670 100644 --- a/ldpl.html.markdown +++ b/ldpl.html.markdown @@ -3,6 +3,7 @@ language: LDPL  filename: learnLDPL.ldpl  contributors:      - ["Martín del Río", "https://github.com/lartu"] +    - ["John Paul Wohlscheid", "https://github.com/JohnBlood"]  ---  **LDPL** is a powerful, C++ transpiled, open-source programming language designed @@ -68,7 +69,7 @@ else if myMap:"someIndex" is not equal to 45 then  else      display "Else!" crlf  end if -# Valid LDPL comparisson operators are +# Valid LDPL comparison operators are  # - IS EQUAL TO  # - IS NOT EQUAL TO  # - IS LESS THAN @@ -123,8 +124,8 @@ get random in myNumber # get a random number between 0 and 1  # files, are divided in sections. The sections found in sub-procedures are  # the PARAMETERS section, the LOCAL DATA section and the PROCEDURE section.  # All sections except the PROCEDURE section can be skipped if they aren't -# used. If no PARAMTERS nor LOCAL DATA sections are used, the PROCEDURE -# keyword may be omited. +# used. If no PARAMETERS nor LOCAL DATA sections are used, the PROCEDURE +# keyword may be omitted.  sub myFunction      parameters:          a is number # LDPL is pass by reference diff --git a/markdown.html.markdown b/markdown.html.markdown index a6000910..cfc0ddf3 100644 --- a/markdown.html.markdown +++ b/markdown.html.markdown @@ -40,9 +40,9 @@ specific to a certain parser.  Markdown is a superset of HTML, so any HTML file is valid Markdown.  ```md -<!--This means we can use HTML elements in Markdown, such as the comment  -element, and they won't be affected by a markdown parser. However, if you  -create an HTML element in your markdown file, you cannot use markdown syntax  +<!--This means we can use HTML elements in Markdown, such as the comment +element, and they won't be affected by a markdown parser. However, if you +create an HTML element in your markdown file, you cannot use markdown syntax  within that element's contents.-->  ``` @@ -370,9 +370,10 @@ Ugh this is so ugly | make it | stop  ## Markdownlint  In order to simplify work with Markdown and to unify its coding style, -`Markdownlint` has been created. This tool is available also as a plugin for -some IDEs and can be used as an utility to ensure validity and readability of -Markdown. +`Markdownlint` has been created. Available as a +[separate tool](https://github.com/markdownlint/markdownlint) +as well as a plugin for some IDEs, it can be used to ensure validity and +readability of Markdown.  --- diff --git a/python.html.markdown b/python.html.markdown index 687529b5..2247f263 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -13,11 +13,13 @@ contributors:  filename: learnpython.py  --- -Python was created by Guido van Rossum in the early 90s. It is now one of the most popular -languages in existence. I fell in love with Python for its syntactic clarity. It's basically -executable pseudocode. +Python was created by Guido van Rossum in the early 90s. It is now one of the +most popular languages in existence. I fell in love with Python for its +syntactic clarity. It's basically executable pseudocode. -Note: This article applies to Python 3 specifically. Check out [here](http://learnxinyminutes.com/docs/pythonlegacy/) if you want to learn the old Python 2.7 +Note: This article applies to Python 3 specifically. Check out +[here](http://learnxinyminutes.com/docs/pythonlegacy/) if you want to learn the +old Python 2.7  ```python @@ -97,8 +99,9 @@ bool(set()) # => False  bool(4)     # => True  bool(-6)    # => True -# Using boolean logical operators on ints casts them to booleans for evaluation, but their non-cast value is returned -# Don't mix up with bool(ints) and bitwise and/or (&,|) +# Using boolean logical operators on ints casts them to booleans for evaluation, +# but their non-cast value is returned. Don't mix up with bool(ints) and bitwise +# and/or (&,|)  bool(0)     # => False  bool(2)     # => True  0 and 2     # => 0 @@ -152,10 +155,10 @@ b == a            # => True, a's and b's objects are equal  # You can find the length of a string  len("This is a string")  # => 16 -# You can also format using f-strings or formatted string literals (in Python 3.6+) +# Since Python 3.6, you can use f-strings or formatted string literals.  name = "Reiko"  f"She said her name is {name}." # => "She said her name is Reiko" -# You can basically put any Python expression inside the braces and it will be output in the string. +# Any valid Python expression inside these braces is returned to the string.  f"{name} is {len(name)} characters long." # => "Reiko is 5 characters long."  # None is an object @@ -294,7 +297,7 @@ filled_dict = {"one": 1, "two": 2, "three": 3}  # Note keys for dictionaries have to be immutable types. This is to ensure that  # the key can be converted to a constant hash value for quick look-ups.  # Immutable types include ints, floats, strings, tuples. -invalid_dict = {[1,2,3]: "123"}  # => Raises a TypeError: unhashable type: 'list' +invalid_dict = {[1,2,3]: "123"}  # => Yield a TypeError: unhashable type: 'list'  valid_dict = {(1,2,3):[1,2,3]}   # Values can be of any type, however.  # Look up values with [] @@ -348,7 +351,7 @@ del filled_dict["one"]  # Removes the key "one" from filled dict  # Sets store ... well sets  empty_set = set() -# Initialize a set with a bunch of values. Yeah, it looks a bit like a dict. Sorry. +# Initialize a set with a bunch of values.  some_set = {1, 1, 2, 2, 3, 4}  # some_set is now {1, 2, 3, 4}  # Similar to keys of a dictionary, elements of a set have to be immutable. @@ -454,8 +457,7 @@ for i in range(4, 8, 2):      print(i)  """ -To loop over a list, and retrieve both the index and the value of each item in the list -prints: +Loop over a list to retrieve both the index and the value of each list item:      0 dog      1 cat      2 mouse @@ -482,10 +484,11 @@ try:      # Use "raise" to raise an error      raise IndexError("This is an index error")  except IndexError as e: -    pass                 # Pass is just a no-op. Usually you would do recovery here. +    pass                 # Refrain from this, provide a recovery (next example).  except (TypeError, NameError): -    pass                 # Multiple exceptions can be handled together, if required. -else:                    # Optional clause to the try/except block. Must follow all except blocks +    pass                 # Multiple exceptions can be processed jointly. +else:                    # Optional clause to the try/except block. Must follow +                         # all except blocks.      print("All good!")   # Runs only if the code in try raises no exceptions  finally:                 # Execute under all circumstances      print("We can clean up resources here") @@ -521,7 +524,8 @@ print(contents)  filled_dict = {"one": 1, "two": 2, "three": 3}  our_iterable = filled_dict.keys() -print(our_iterable)  # => dict_keys(['one', 'two', 'three']). This is an object that implements our Iterable interface. +print(our_iterable)  # => dict_keys(['one', 'two', 'three']). This is an object +                     # that implements our Iterable interface.  # We can loop over it.  for i in our_iterable: @@ -533,15 +537,16 @@ our_iterable[1]  # Raises a TypeError  # An iterable is an object that knows how to create an iterator.  our_iterator = iter(our_iterable) -# Our iterator is an object that can remember the state as we traverse through it. -# We get the next object with "next()". +# Our iterator is an object that can remember the state as we traverse through +# it. We get the next object with "next()".  next(our_iterator)  # => "one"  # It maintains state as we iterate.  next(our_iterator)  # => "two"  next(our_iterator)  # => "three" -# After the iterator has returned all of its data, it raises a StopIteration exception +# After the iterator has returned all of its data, it raises a +# StopIteration exception  next(our_iterator)  # Raises StopIteration  # We can also loop over it, in fact, "for" does this implicitly! @@ -549,7 +554,7 @@ our_iterator = iter(our_iterable)  for i in our_iterator:      print(i)  # Prints one, two, three -# You can grab all the elements of an iterable or iterator by calling list() on it. +# You can grab all the elements of an iterable or iterator by call of list().  list(our_iterable)  # => Returns ["one", "two", "three"]  list(our_iterator)  # => Returns [] because state is saved @@ -599,9 +604,9 @@ all_the_args(1, 2, a=3, b=4) prints:  # Use * to expand tuples and use ** to expand kwargs.  args = (1, 2, 3, 4)  kwargs = {"a": 3, "b": 4} -all_the_args(*args)            # equivalent to all_the_args(1, 2, 3, 4) -all_the_args(**kwargs)         # equivalent to all_the_args(a=3, b=4) -all_the_args(*args, **kwargs)  # equivalent to all_the_args(1, 2, 3, 4, a=3, b=4) +all_the_args(*args)            # equivalent: all_the_args(1, 2, 3, 4) +all_the_args(**kwargs)         # equivalent: all_the_args(a=3, b=4) +all_the_args(*args, **kwargs)  # equivalent: all_the_args(1, 2, 3, 4, a=3, b=4)  # Returning multiple values (with tuple assignments)  def swap(x, y): @@ -611,7 +616,7 @@ def swap(x, y):  x = 1  y = 2  x, y = swap(x, y)     # => x = 2, y = 1 -# (x, y) = swap(x,y)  # Again parenthesis have been excluded but can be included. +# (x, y) = swap(x,y)  # Again the use of parenthesis is optional.  # global scope  x = 5 @@ -659,7 +664,7 @@ list(map(max, [1, 2, 3], [4, 2, 1]))  # => [4, 2, 3]  list(filter(lambda x: x > 5, [3, 4, 5, 6, 7]))  # => [6, 7]  # We can use list comprehensions for nice maps and filters -# List comprehension stores the output as a list which can itself be a nested list +# List comprehension stores the output as a list (which itself may be nested).  [add_10(i) for i in [1, 2, 3]]         # => [11, 12, 13]  [x for x in [3, 4, 5, 6, 7] if x > 5]  # => [6, 7] @@ -719,8 +724,8 @@ class Human:      # Note that the double leading and trailing underscores denote objects      # or attributes that are used by Python but that live in user-controlled      # namespaces. Methods(or objects or attributes) like: __init__, __str__, -    # __repr__ etc. are called special methods (or sometimes called dunder methods) -    # You should not invent such names on your own. +    # __repr__ etc. are called special methods (or sometimes called dunder +    # methods). You should not invent such names on your own.      def __init__(self, name):          # Assign the argument to the instance's name attribute          self.name = name @@ -774,7 +779,7 @@ if __name__ == '__main__':      i.say("hi")                     # "Ian: hi"      j = Human("Joel")      j.say("hello")                  # "Joel: hello" -    # i and j are instances of type Human, or in other words: they are Human objects +    # i and j are instances of type Human; i.e., they are Human objects.      # Call our class method      i.say(i.get_species())          # "Ian: H. sapiens" @@ -811,8 +816,8 @@ if __name__ == '__main__':  # "species", "name", and "age", as well as methods, like "sing" and "grunt"  # from the Human class, but can also have its own unique properties. -# To take advantage of modularization by file you could place the classes above in their own files, -# say, human.py +# To take advantage of modularization by file you could place the classes above +# in their own files, say, human.py  # To import functions from other files use the following format  # from "filename-without-extension" import "function-or-class" @@ -936,8 +941,8 @@ class Batman(Superhero, Bat):          # However we are dealing with multiple inheritance here, and super()          # only works with the next base class in the MRO list.          # So instead we explicitly call __init__ for all ancestors. -        # The use of *args and **kwargs allows for a clean way to pass arguments, -        # with each parent "peeling a layer of the onion". +        # The use of *args and **kwargs allows for a clean way to pass +        # arguments, with each parent "peeling a layer of the onion".          Superhero.__init__(self, 'anonymous', movie=True,                             superpowers=['Wealthy'], *args, **kwargs)          Bat.__init__(self, *args, can_fly=False, **kwargs) @@ -1036,8 +1041,6 @@ print(say())                 # Can you buy me a beer?  print(say(say_please=True))  # Can you buy me a beer? Please! I am poor :(  ``` -## Ready For More? -  ### Free Online  * [Automate the Boring Stuff with Python](https://automatetheboringstuff.com) diff --git a/rdf.html.markdown b/rdf.html.markdown index 4cb7ddd0..5b2105b8 100644 --- a/rdf.html.markdown +++ b/rdf.html.markdown @@ -28,7 +28,7 @@ usually look like URLs but function as identifiers, not locators. The use of  URIs provides context for resource identifiers to make them unambiguous—for  example, to tell a book title from a job title. -```turtle +```  # The hash symbol is the comment delimiter.   # Turtle triple statements end with periods like natural language sentences. diff --git a/vim.html.markdown b/vim.html.markdown index f5be9b0d..e0fdf2e0 100644 --- a/vim.html.markdown +++ b/vim.html.markdown @@ -29,7 +29,7 @@ specific points in the file, and for fast editing.      :q!               # Quit vim without saving file                        # ! *forces* :q to execute, hence quiting vim without saving      ZQ                # Quit vim without saving file -    :x                # Save file and quit vim, shorter version of :wq +    :x                # Save file(only when the file is modified) and quit vim      u                 # Undo      CTRL+R            # Redo | 
