Category:Python: Difference between revisions

From Rosetta Code
Content added Content deleted
(update)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{language
{{language
|exec=interpreted
|exec=interpreted
|site=http://www.python.org
|site=https://www.python.org
|strength=strong
|strength=strong
|safety=safe
|safety=safe
Line 9: Line 9:
|gc=yes
|gc=yes
|LCT=yes
|LCT=yes
|bnf=http://docs.python.org/py3k/reference/grammar.html}}{{language programming paradigm|Dynamic}}{{language programming paradigm|Object-oriented}}{{codepad}}From the official [http://www.python.org Python] website: "Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs."
|bnf=https://docs.python.org/3/reference/grammar.html}}{{language programming paradigm|Dynamic}}{{language programming paradigm|Object-oriented}}{{codepad}}From the official [https://www.python.org Python] website: "Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs."


It is easy to create clean bug-free programs in Python due to the motto: "Errors should never pass silently." Python is an [[wp:Interpreter (computing)|interpreter]]. Python source files (.py files) are typically compiled to an intermediate [[bytecode]] language (.pyc files) and executed by a Python Virtual Machine.
It is easy to create clean bug-free programs in Python due to the motto: "Errors should never pass silently." Python is an [[wp:Interpreter (computing)|interpreter]]. Python source files (.py files) are typically compiled to an intermediate [[bytecode]] language (.pyc files) and executed by a Python Virtual Machine.


===Notes===
=Complete the implementation of the stub function q1_mod_inverse(a, n) according to the following specification:
Because Python uses whitespace for structure, do not format long code examples with leading whitespace, instead use <code><nowiki><pre></pre></nowiki></code> tags, or, preferably, <code><nowiki><syntaxhighlight lang="python"></syntaxhighlight></nowiki></code> tags. This will make it easier to copy code into and out of the wiki. Example:
<syntaxhighlight lang="python">print('this line must not have leading indentation!')
if True:
print('example: ', foo(3), len(bar))</syntaxhighlight>


Some Python examples may deviate from idiomatic Python because they may be written to work in Python 3.X as well as Python 2.X environments. This includes doing things like:
if there exists a multiplicative inverse of a (mod n) then it should return that value, even if it is negative;
* Using brackets in print statements/functions of one expression.
if there is no multiplicative inverse of a (mod n) it should return the special value None
* Using zip and not izip; keys(), values(), items() and not their iter- forms.
You may implement (and call from q1_mod_inverse(a, n)) any additional function required to assist in this task.
* Checking for raw_input and setting raw_input to input if not found.
* Conditionally importing reduce if it is not found.
This style is not a requirement for Python code on RC, but it may be in use and should not necessarily be 'corrected' if found in examples.


The command line is often used in Python for short pieces of code, and so, again; examples showing such use are not incorrect and may be left.
If your implementation does not correspond to the specification above (for instance, if you obtain a solution from the web, but do not correctly adapt it) then you will receive zero. Hint: You do not need to go beyond the materials provided in this unit for a solution.


==See Also==
==See Also==
* [[wp:python_(programming_language)|Wikipedia: Python]]
* [[wp:python_(programming_language)|Wikipedia: Python]]

==Todo==
[[Tasks_not_implemented_in_Python]]

Latest revision as of 16:10, 21 August 2023

Language
Python
This programming language may be used to instruct a computer to perform a task.
Official website
Execution method: Interpreted
Garbage collected: Yes
Parameter passing methods: By object reference
Type safety: Safe
Type strength: Strong
Type expression: Implicit
Type checking: Dynamic
See Also:
Listed below are all of the tasks on Rosetta Code which have been solved using Python.
Try this language on Codepad.

From the official Python website: "Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs."

It is easy to create clean bug-free programs in Python due to the motto: "Errors should never pass silently." Python is an interpreter. Python source files (.py files) are typically compiled to an intermediate bytecode language (.pyc files) and executed by a Python Virtual Machine.

Notes

Because Python uses whitespace for structure, do not format long code examples with leading whitespace, instead use <pre></pre> tags, or, preferably, <syntaxhighlight lang="python"></syntaxhighlight> tags. This will make it easier to copy code into and out of the wiki. Example:

print('this line must not have leading indentation!')
if True:
    print('example: ', foo(3), len(bar))

Some Python examples may deviate from idiomatic Python because they may be written to work in Python 3.X as well as Python 2.X environments. This includes doing things like:

  • Using brackets in print statements/functions of one expression.
  • Using zip and not izip; keys(), values(), items() and not their iter- forms.
  • Checking for raw_input and setting raw_input to input if not found.
  • Conditionally importing reduce if it is not found.

This style is not a requirement for Python code on RC, but it may be in use and should not necessarily be 'corrected' if found in examples.

The command line is often used in Python for short pieces of code, and so, again; examples showing such use are not incorrect and may be left.

See Also

Todo

Tasks_not_implemented_in_Python

Subcategories

This category has the following 18 subcategories, out of 18 total.

K

L

M

N

P

S

T

V

W

Pages in category "Python"

The following 200 pages are in this category, out of 1,513 total.

(previous page) (next page)

A

(previous page) (next page)