diff --git a/.idea/SG-Basic-Gen.03.iml b/.idea/SG-Basic-Gen.03.iml new file mode 100644 index 0000000..6711606 --- /dev/null +++ b/.idea/SG-Basic-Gen.03.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..5c9a502 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ecc1a96 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..e390c27 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,482 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1490102214791 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataLatihan/answer1.py b/DataLatihan/answer1.py index a489c87..74c3f83 100644 --- a/DataLatihan/answer1.py +++ b/DataLatihan/answer1.py @@ -7,3 +7,14 @@ def readData(data1): for line in data : x = line.split() return x + +x = readData(data1) +txt = [] +for i in x: + if i == 'I': + txt.append('*') + elif i == 'and' or i == 'The' or i == 'you': + txt.append('*'*3) + else: txt.append(i) +txt = ' '.join(txt) +print(txt) \ No newline at end of file diff --git a/DataLatihan/answer2.py b/DataLatihan/answer2.py index 5d28fd2..6d0fe91 100644 --- a/DataLatihan/answer2.py +++ b/DataLatihan/answer2.py @@ -6,4 +6,26 @@ def readData(data1): with open(data1) as data : for line in data : x = line.split() -return x + return x + +def unique(y): + output = [] + for x in y: + if x not in output: + output.append(x) + return output + +x = readData(data1) +y = readData(data2) + +x = unique(x) +y = unique(y) + +a = set(x).intersection(y) + +print (a) + + + + + diff --git a/DataTugas/answer3.py b/DataTugas/answer3.py new file mode 100644 index 0000000..7f96fd0 --- /dev/null +++ b/DataTugas/answer3.py @@ -0,0 +1,33 @@ +data1 = "DataSet.txt" + +def readData(data1): + x = [] + with open(data1) as data: + for line in data: + x = line.split() + return x + +x = readData(data1) +y = [] +z = [] +for i in x: + if (i.isdigit() == True) : + y.append(i) +for i in x : + if (i.isdigit() == True) : + z.append(y.pop()) + else : z.append(i) +k = [] +i = z[0] +i = ' '.join(l[0].upper() + l[1:] for l in i.split()) +k.append(i) + +for count in range(1,len(z)): + i = z[count] + n = z[count-1] + if (n[len(n)-1] == '.') : + i = ' '.join(l[0].upper() + l[1:] for l in i.split()) + k.append(i) + +k = ' '.join(k) +print (k) \ No newline at end of file diff --git a/Pertemuan 2/Latihan.txt b/Pertemuan 2/Latihan.txt index 8706001..6536a80 100644 --- a/Pertemuan 2/Latihan.txt +++ b/Pertemuan 2/Latihan.txt @@ -2,6 +2,9 @@ SOAL Buatlah tranpose matriks tanpa menggunakan library. +<<<<<<< HEAD +======= [[12,7], [4 ,5], - [3 ,8]] \ No newline at end of file + [3 ,8]] +>>>>>>> refs/remotes/ComputingTelU/master diff --git a/Pertemuan 2/answer1.py b/Pertemuan 2/answer1.py new file mode 100644 index 0000000..869d13e --- /dev/null +++ b/Pertemuan 2/answer1.py @@ -0,0 +1,9 @@ +import numpy as np + +a = np.array([[1,2,3], + [4,5,6], + [7,8.9]]) +b = a.transpose() +print (b) +print (a) +print (np.transpose(a)) \ No newline at end of file