From 647aaa8010782af32b978b5f17b39e7d885305c2 Mon Sep 17 00:00:00 2001 From: AlfianR7 Date: Tue, 21 Mar 2017 20:45:38 +0700 Subject: [PATCH 1/3] Alfian Rahman A Tugas 1 --- .idea/SG-Basic-Gen.03.iml | 11 ++ .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 351 ++++++++++++++++++++++++++++++++++++++ DataLatihan/answer1.py | 15 +- DataLatihan/answer2.py | 28 ++- 7 files changed, 418 insertions(+), 5 deletions(-) create mode 100644 .idea/SG-Basic-Gen.03.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml 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..df87b37 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,351 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1490102214791 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataLatihan/answer1.py b/DataLatihan/answer1.py index ea4b036..74c3f83 100644 --- a/DataLatihan/answer1.py +++ b/DataLatihan/answer1.py @@ -1,5 +1,5 @@ -data1 = "Data_1.txt" -data2 = "Data_2.txt" +data1 = "Data1.txt" +data2 = "Data2.txt" def readData(data1): x = [] @@ -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 19d4180..6d0fe91 100644 --- a/DataLatihan/answer2.py +++ b/DataLatihan/answer2.py @@ -1,9 +1,31 @@ -data1 = "Data_1.txt" -data2 = "Data_2.txt" +data1 = "Data1.txt" +data2 = "Data2.txt" def readData(data1): x = [] 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) + + + + + From 9e51fb0ff699ba11484f67d3f97dbfee8d48f9f2 Mon Sep 17 00:00:00 2001 From: AlfianR7 Date: Tue, 28 Mar 2017 16:15:29 +0700 Subject: [PATCH 2/3] datatugas datatugas --- DataTugas/answer3.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 DataTugas/answer3.py 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 From da23651eb02568db588eef1aa05e797e2ad03bd8 Mon Sep 17 00:00:00 2001 From: AlfianR7 Date: Tue, 4 Apr 2017 20:53:04 +0700 Subject: [PATCH 3/3] a a --- .idea/workspace.xml | 213 ++++++++++++++++++++++++++++++++-------- Pertemuan 2/Latihan.txt | 3 +- Pertemuan 2/answer1.py | 9 ++ 3 files changed, 183 insertions(+), 42 deletions(-) create mode 100644 Pertemuan 2/answer1.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index df87b37..e390c27 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,9 @@ - - + + + - - + + @@ -28,6 +29,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -40,20 +61,29 @@ + + + - @@ -72,7 +102,6 @@ - @@ -82,32 +111,19 @@ + - + + + - + + - - - + + + + @@ -301,26 +336,26 @@ - - + + - + - - - - + + + - - - + + - - + + + + @@ -331,6 +366,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -347,5 +462,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Pertemuan 2/Latihan.txt b/Pertemuan 2/Latihan.txt index f67db92..70cab04 100644 --- a/Pertemuan 2/Latihan.txt +++ b/Pertemuan 2/Latihan.txt @@ -1,3 +1,4 @@ SOAL -Buatlah tranpose matriks tanpa menggunakan library. \ No newline at end of file +Buatlah tranpose matriks tanpa menggunakan library. + 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