py-repo

a python playground
Index Commits Files Refs README
commit a875fd1491937705e92a5345e381dc04316bf3bc
parent 266698c4bd81dd32d151fbe9b7c59e72e1c35d61
Author: Martin J. Klöckner <martin.cachari@gmail.com>
Date:   Thu, 19 Nov 2020 19:05:28 -0300

Added a couple of tests copied from yt channel "freeCodeCamp.org"

Diffstat:
Mdegree.py | 0
Adivisas.py | 9+++++++++
Afunctions.py | 16++++++++++++++++
Alists.py | 20++++++++++++++++++++
Alists2.py | 35+++++++++++++++++++++++++++++++++++
Atupples.py | 8++++++++
6 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/degree.py b/degree.py
diff --git a/divisas.py b/divisas.py
@@ -0,0 +1,9 @@
+#define MAX_DIVISAS 2
+
+divisa_origen = ARS
+divisa_destino = USD
+
+monto_origen = 1000
+monto_destino
+
+divisas[MAX_DIVISAS][MAX_DIVISAS]
diff --git a/functions.py b/functions.py
@@ -0,0 +1,16 @@
+
+def myFuntion():
+    #    Statements
+    return
+
+def sayHi(name):
+    print("Hello " + name + "!")
+
+def echoAge(age):
+    print("You're " + age + " years old.")
+
+name = input("What's your name?: ")
+age = input("How old are you?: ")
+
+sayHi(name)
+echoAge(age)
diff --git a/lists.py b/lists.py
@@ -0,0 +1,20 @@
+
+myList = ["Martin", 21, True]
+
+names = ["Veronica" , "Martin", "Malena", "Paula"]
+ages = [23, 21, 19, 16]
+
+print(myList[1])
+
+print(names)
+print(names[-1])
+print(names[2:])
+print(names[1:2])
+
+print(ages)
+
+myList [0] = "Javier"
+print(myList)
+
+
+
diff --git a/lists2.py b/lists2.py
@@ -0,0 +1,35 @@
+
+lucky_numbers = [4, 8, 15, 16, 23, 42, 18]
+friends = ["Kevin", "Karen", "Jim", "Jim", "Oscar", "Tom"]
+friends2 = friends.copy()
+
+print(friends)
+print(friends2)
+
+print(friends.index("Oscar"))
+print(friends.count("Jim"))
+
+friends.append("Mike")
+print(friends)
+
+friends.insert(1, "Kelly")
+print(friends)
+
+friends.remove("Mike")
+print(friends)
+
+friends.pop()
+
+friends.extend(lucky_numbers)
+print(friends)
+
+friends.clear()
+
+print(lucky_numbers)
+lucky_numbers.sort()
+print(lucky_numbers)
+
+lucky_numbers.reverse()
+print(lucky_numbers)
+
+
diff --git a/tupples.py b/tupples.py
@@ -0,0 +1,8 @@
+#    Tupples is a type of a data structure, in a nutshell its a container
+#    where we can store different values, similar to lists
+#    A tupple is unmutable, it cannot be changed!
+
+coordinate = (4, 5)
+coordinates = [(4, 5), (2, 4), (65, 2)]
+
+print(coordinate[1])