import matplotlib.pyplot as plt
import sys
+
# Mainloop
def main():
-
+
# matplotlib setup
matplotlib.use("AGG")
plt.figure()
-
+
# Accept multiple csv-files
arg_len = len(sys.argv) - 1
csv_files = list()
# Adds labels and info about current functions
plt.xlabel("Dagar")
plt.ylabel("Antal koppar")
- plt.legend(loc='upper left', bbox_to_anchor=(1, 0, 1, 1))
+ plt.legend(loc="upper left", bbox_to_anchor=(1, 0, 1, 1))
plt.savefig(__file__[0:-3] + ".png", bbox_inches="tight")
--- /dev/null
+class Contact:
+ def __init__(self, name):
+ self.name = name
+ self.phone_num = ""
+
+ def append_to_name(self, string_to_append):
+ self.name += string_to_append
+
+ def __str__(self):
+ return "{}, {}".format(self.name, self.phone_num)
+
+ def __myMethod__(self):
+ print("hello")
+
+
+c1 = Contact("Nils")
+c2 = Contact("Lukas")
+c3 = Contact("Pisse")
+
+c1.phone_num = "0701-111111"
+c2.phone_num = "0702-222222"
+c3.phone_num = "0703-333333"
+
+c1.append_to_name(" Forssen")
+c2.append_to_name(" Eliasson")
+c3.append_to_name(" Sjögren")
+
+contact_list = [c1, c2, c3]
+
+for contact in contact_list:
+ print(contact)
--- /dev/null
+class Pet:
+ def __init__(self, name=""):
+ self.kind = ""
+ self.toys = []
+ self.name = name
+
+ def add_toy(self, toy):
+ if toy not in self.toys:
+ self.toys.append(toy)
+
+ def __str__(self):
+ if len(self.toys) == 0:
+ return "{} är en {} som inte har några leksaker!".format(
+ self.name, self.kind
+ )
+ else:
+ return "{} är en {} som har följande leksaker: {}!".format(
+ self.name, self.kind, ", ".join(self.toys)
+ )
--- /dev/null
+from klasser import *
+
+hund1 = Pet()
+hund1.name = "Pluto"
+hund1.kind = "hund"
+
+
+# hund1.add_toy("boll")
+print(hund1)
+
+katt1 = Pet("Misse")
+katt1.kind = "katt"
+
+katt1.add_toy("fjäder")
+print(katt1)
+
+katt1.add_toy("höna")
+print(katt1)