From 59a70b33bfb0d2a75b6f32881c36c512a452cde0 Mon Sep 17 00:00:00 2001 From: lepatrick714 Date: Mon, 17 Jul 2017 21:49:56 -0700 Subject: [PATCH] Added some python features --- sheets/_python/func | 15 +++++++++++++++ sheets/_python/loops | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 sheets/_python/func create mode 100644 sheets/_python/loops diff --git a/sheets/_python/func b/sheets/_python/func new file mode 100644 index 0000000..6ef8832 --- /dev/null +++ b/sheets/_python/func @@ -0,0 +1,15 @@ +# Simple function +def functionName(): + return True + +# Function with parameters +def functionName(a, b): + if(a < b): + return a + else: + return b + +# Return multiple values +def functionName(a, b, c): + return (a, b, c) // Returns a tuple + return {'return_a':a, 'return_b':b ,'return_c':c } // Returns a dictionary diff --git a/sheets/_python/loops b/sheets/_python/loops new file mode 100644 index 0000000..a9eda56 --- /dev/null +++ b/sheets/_python/loops @@ -0,0 +1,13 @@ +# Basic +if x > 0: + print(x) +else: + print(-x) + +# if else +if x > 0: + print(x) +elif x == 0: + print(420) +else: + print(-x)