From 39d8753d5285348b998a7b87ae68614acf816df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Polykanine=20A=2EK=2EA=2E=20Menelion=20Elens=C3=BA?= =?UTF-8?q?l=C3=AB?= Date: Thu, 9 Oct 2014 22:49:47 +0300 Subject: [PATCH] [python/en] Adding exponentiation operator --- python.html.markdown | 4 ++++ python3.html.markdown | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/python.html.markdown b/python.html.markdown index 390c7b76..a980b6dc 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -3,6 +3,7 @@ language: python contributors: - ["Louie Dinh", "http://ldinh.ca"] - ["Amin Bandali", "http://aminbandali.com"] + - "Andre Polykanine", "https://github.com/Oire"] filename: learnpython.py --- @@ -54,6 +55,9 @@ to Python 2.x. Look for another tour of Python 3 soon! # Modulo operation 7 % 3 # => 1 +# Exponentiation (x to the y'th power) +2 ** 4 # => 16 + # Enforce precedence with parentheses (1 + 3) * 2 # => 8 diff --git a/python3.html.markdown b/python3.html.markdown index a94f4eae..6fce9bf7 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -3,6 +3,7 @@ language: python3 contributors: - ["Louie Dinh", "http://pythonpracticeprojects.com"] - ["Steven Basart", "http://github.com/xksteven"] + - ["Andre Polykanine", "https://github.com/Oire"] filename: learnpython3.py --- @@ -50,6 +51,9 @@ Note: This article applies to Python 3 specifically. Check out the other tutoria # Modulo operation 7 % 3 # => 1 +# Exponentiation (x to the y'th power) +2 ** 4 # => 16 + # Enforce precedence with parentheses (1 + 3) * 2 # => 8