From ba91cfc023bc9b9c0f934335a1f37c238f70f0b0 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Tue, 15 Oct 2019 12:13:32 +0100 Subject: [PATCH 01/16] Enter --- Week-3/test_toys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week-3/test_toys.py b/Week-3/test_toys.py index edb4837..4ef5ca8 100644 --- a/Week-3/test_toys.py +++ b/Week-3/test_toys.py @@ -1,6 +1,6 @@ ''' test_toys.py - +print("hi") Unit tests for toy functions. ''' From 9a0c38e5df755f8773642b8c374f86b703573f12 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Tue, 15 Oct 2019 14:52:58 +0100 Subject: [PATCH 02/16] Enter --- Week-3/__pycache__/toys.cpython-37.pyc | Bin 0 -> 858 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Week-3/__pycache__/toys.cpython-37.pyc diff --git a/Week-3/__pycache__/toys.cpython-37.pyc b/Week-3/__pycache__/toys.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c659e1636dca60141eedd64c16a2ebc7df379af6 GIT binary patch literal 858 zcmb7C-%H#;5Z=99ez=-a-+auQ+=Id)NGT$v`X=1VQ3?_XF|(fW?vgOOQ7nD4|4O0# zm-6a=(WlOAdu==_)P`ju@ZD%fBSl|I~3xPgVh<3^Ny~0Lk7gT011OH z;#`6UL&5?05D%Xb{s*t3G4RX7wA#WkHeF<=?A0Hq&MxN%+phC=C*E9FrdeKq@Zan^&O`lwVv-Cq`!rC zURf2J+=*KXi9XpUQdo|YLPK0ha4km?xyJdw3}mU(;d+q6_&o2x z@pkfZo!T?)a;L``y_6F}s#s?Yi8Uk9NsoDhnfnj&yxM8%rxNqe1i6@t-ap#^g^%VHai@)J2xL7eyXF^1P6L4OxoI?D6s% ap?kvUXjwzM(8pZmR&eM?K@>(2UG)=2WtK|- literal 0 HcmV?d00001 From f4b488299eafd34b54941a0b56d439e803940a3c Mon Sep 17 00:00:00 2001 From: Julian syn Date: Thu, 17 Oct 2019 15:02:27 +0100 Subject: [PATCH 03/16] Enter --- test week 2/class.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test week 2/class.py diff --git a/test week 2/class.py b/test week 2/class.py new file mode 100644 index 0000000..a8d1bc1 --- /dev/null +++ b/test week 2/class.py @@ -0,0 +1,9 @@ +Print("hello!") + +number = int(input('please guess a number: ')) +if number == 4: + print('you guessed it!, good job') +else: + print('better luck next time!') + + From 5798f74adfb89d2d9b69cc16584eada19b0203fe Mon Sep 17 00:00:00 2001 From: Julian syn Date: Thu, 17 Oct 2019 16:38:06 +0100 Subject: [PATCH 04/16] Enter --- test week 2/class.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test week 2/class.py b/test week 2/class.py index a8d1bc1..f6ccf42 100644 --- a/test week 2/class.py +++ b/test week 2/class.py @@ -1,4 +1,4 @@ -Print("hello!") +Print("hey there!") number = int(input('please guess a number: ')) if number == 4: From baec7150cbdf6c14d7cfb6c84afee5ee3338dd55 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Thu, 17 Oct 2019 19:27:35 +0100 Subject: [PATCH 05/16] added test 1 --- test week 2/class.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test week 2/class.py b/test week 2/class.py index f6ccf42..adb13d1 100644 --- a/test week 2/class.py +++ b/test week 2/class.py @@ -1,4 +1,4 @@ -Print("hey there!") +Print("hello there!") number = int(input('please guess a number: ')) if number == 4: From 90ec46abadf30fa0b752ba1862d75b3d327adec1 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Mon, 21 Oct 2019 15:06:17 +0100 Subject: [PATCH 06/16] hi to hello --- yummy.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 yummy.py diff --git a/yummy.py b/yummy.py new file mode 100644 index 0000000..f997c32 --- /dev/null +++ b/yummy.py @@ -0,0 +1 @@ +print("hello there!") \ No newline at end of file From 121fb12d5a18a9f97b2372eb083765bca4d4bd52 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Mon, 21 Oct 2019 15:36:40 +0100 Subject: [PATCH 07/16] testing --- Week-3/__pycache__/toys.cpython-37.pyc | Bin 858 -> 893 bytes Week-3/toys.py | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Week-3/__pycache__/toys.cpython-37.pyc b/Week-3/__pycache__/toys.cpython-37.pyc index c659e1636dca60141eedd64c16a2ebc7df379af6..dd4f2001d377922babb2dcc1bb5cde2d29caa64c 100644 GIT binary patch delta 468 zcmaJ;!AiqG5Z#H*?lv`5K@dGi6-wz%5a~ft(W~_0Eg(y678J8~c7 zd<8ybWssy}gEm`Wx<$3~2n3)ia_H_=IQCTXtm>P2F zQ1RD3;IWSW8A~P3*hic8YN8g~9j@#mIiKLj*+` z7C|Xq#4CVE1+`%sgAa3@XC)<&dstt$yI^$IBYF(Ta^!piead_^&t?`~Sz)$I zb-^3~D4QP`9k#ll)p>a8N}Dejf@acrhlGm6T^f~M71h$xlw&IX><7Ho-al(KZ^1r9 z?0vHF_A-CQq;OuM%Ux1-Cp6!|QDVq?8Y{1?O;3t+b|yegRG4O6vds diff --git a/Week-3/toys.py b/Week-3/toys.py index 51868b5..ed1cc42 100644 --- a/Week-3/toys.py +++ b/Week-3/toys.py @@ -9,7 +9,7 @@ # write a function that adds 1 # to the input and prints the result def inc(a): - print(a) + print(a+1) # write a function that adds 1 @@ -51,3 +51,4 @@ def string_repeat(phrase, repeat): # in order to concatenate them return +print("hi there!") \ No newline at end of file From 1ef8f12da3822d9d2edcb1bbd7740b02a06d3676 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Tue, 22 Oct 2019 01:02:28 +0100 Subject: [PATCH 08/16] learning new coding languages --- Week-3/__pycache__/test_toys.cpython-37.pyc | Bin 0 -> 1862 bytes yummy.py | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Week-3/__pycache__/test_toys.cpython-37.pyc diff --git a/Week-3/__pycache__/test_toys.cpython-37.pyc b/Week-3/__pycache__/test_toys.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe31bb418a15e8be11d42e50ca69a7168be4e48b GIT binary patch literal 1862 zcmbVN%}>-o6rXue@mFb%p<}~uI(9L4bS8?R@>LbW3C<7Pl!gCzD3&g(Njlp zsi=w%ATS?f};4U0^ zIl|t6Pu>Ng$T7e@(Y|Ph?MQ1@4Vu2U&X@?lZ-DfbmMTCs36*1?!4oCe_^F_HUO!e?cl{0TqO}O zF&%9*UC^;OIlh>e`=Fllf^3w`7#TArFjE_?lvwe~3NtbZUG+HzhB8uQsW~>_-Z4gE zj2;0sq6TwnfQ6{Ts;vtPCSjvM5^{lL7KlJ|4t52i=6OVLd~HN8NR`jbp~#C<#BD$z*Z!43^XiB;}uYnZR%Sf#jD(t&w2@E4X_86cVK3 zYz0!TaV$c|C56Uvnk zB>0f~SnQa5QbBXwEfqYY&kw{6aK>xGs{Ee-^jf(Av>v?V$}G$ymfI|yLWEMQMl9FZ zY)_>&rI8hi@FlNaB*G)>XyX7YWTcManF@xe33d~e-2gPZrXDh6CfsGm~N}{ke z+nW4kC-`XS2N9)hE43(PahFohPT;o&GcNBdHm2By4?Pqw6WHxj6Rj?KFtyim-=Aak PO7y`rY~9vp7HsV=;=HT0 literal 0 HcmV?d00001 diff --git a/yummy.py b/yummy.py index f997c32..3688de5 100644 --- a/yummy.py +++ b/yummy.py @@ -1 +1,3 @@ -print("hello there!") \ No newline at end of file +print("hello there!") + +print("I want to learn html and Java now.") \ No newline at end of file From 0bdcc1f8bbf40c0ace04bcf21a0d406697352840 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Tue, 22 Oct 2019 10:32:51 +0100 Subject: [PATCH 09/16] testing --- yummy.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/yummy.py b/yummy.py index 3688de5..db330a8 100644 --- a/yummy.py +++ b/yummy.py @@ -1,3 +1,11 @@ print("hello there!") -print("I want to learn html and Java now.") \ No newline at end of file +print("I want to learn html and Java now.") + +words = ("bad", "badminton", "badass", "good", "happy", "joy") + +for item in words: + if "bad" in item: + continue + else: + print(item) \ No newline at end of file From 40e4dd7e41008a8182b837ae275e6a099f47365f Mon Sep 17 00:00:00 2001 From: Julian syn Date: Wed, 23 Oct 2019 16:02:21 +0100 Subject: [PATCH 10/16] trial --- Week-3/toys.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Week-3/toys.py b/Week-3/toys.py index ed1cc42..4ae0057 100644 --- a/Week-3/toys.py +++ b/Week-3/toys.py @@ -6,11 +6,15 @@ ''' + # write a function that adds 1 # to the input and prints the result -def inc(a): - print(a+1) +def add(val1): + result = val1 + 1 + return result + +print(add(3)) # write a function that adds 1 # to the input and returns the result @@ -22,7 +26,9 @@ def inc_return(a): # the two input numbers together # and returns the sum def sum(a, b): - return + result = a + b + return result +print(sum(3, 4)) # write a function that takes two @@ -30,7 +36,11 @@ def sum(a, b): # sum() and then increments the sum # using inc_return def sum_inc(a, b): - return + result = sum(a + b) + inc_return result + +print(sum_inc(4, 6)) + # write a function that returns a From 06a36fde501e2cf857518ae5fdd74b8c7a6d74fd Mon Sep 17 00:00:00 2001 From: Julian syn Date: Wed, 23 Oct 2019 16:04:18 +0100 Subject: [PATCH 11/16] . --- Week-4/__pycache__/structures.cpython-37.pyc | Bin 0 -> 1316 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Week-4/__pycache__/structures.cpython-37.pyc diff --git a/Week-4/__pycache__/structures.cpython-37.pyc b/Week-4/__pycache__/structures.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..023f056250017a983f23d313d15cb23cc351acd6 GIT binary patch literal 1316 zcmb7@&2G~`5XYSlCytvm{o=&M5~m;)DX6EaLO>D6s#1lJtf1A_Gf7Px+nQaMhBGe% zLOhUfh_~Rxj7z9VRjFNR_dmPdo!{(u_Vr-kJKVng{PE#?&vAaqWYwB%yyR|9c>pJL zpaIP9 zr6RHgp?Q`seg7<8+97l4bHWRqu_LDFL(ml>Y(N- z2>htQAxjgLe$3spd6+rOZk&AOq4ewpswC#4vZWe+9~~b~-Wen_`B)^ep1eUbw^=>` z132D~vPE84j%Pf1k2v2ynAEuWvfP};WUSIDs6-pPAyi4D(;$IIEwQV&ox;^c*()y9zo~Jd6RQ`SQ#I;&cFv4-zTX}oFj(iklX{0$C?rOEm9Mqsv68D9cKE%~a(6lUD zb6l?D`qh6?c*Qkrj%t+62T-Wbn@jgnC&jH4_N&#ufLArZ)&l_H#?3Xx^~tUD?JSUH zsQzt_(Y&oex7j`!`DIrr$ReexH$_tJB=tyAHY9(QB+Dd8APJP@U@do2tJiPHJ6dE= YB>2MRC9}gryW{n|uIF+0d2~JZ53>;iOaK4? literal 0 HcmV?d00001 From ab6eebc55913700c2a51cfb6f2e942f7f56bfd16 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Fri, 25 Oct 2019 00:34:55 +0100 Subject: [PATCH 12/16] trialed and errored --- .../__pycache__/test_pendulum.cpython-37.pyc | Bin 0 -> 1281 bytes Week-3/__pycache__/test_toys.cpython-37.pyc | Bin 1862 -> 2248 bytes Week-3/__pycache__/toys.cpython-37.pyc | Bin 893 -> 1084 bytes Week-3/test_pendulum.py | 2 +- Week-3/toys.py | 23 ++++++++++++------ Week-4/__pycache__/structures.cpython-37.pyc | Bin 1316 -> 1440 bytes Week-4/structures.py | 12 +++++++-- 7 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 Week-3/__pycache__/test_pendulum.cpython-37.pyc diff --git a/Week-3/__pycache__/test_pendulum.cpython-37.pyc b/Week-3/__pycache__/test_pendulum.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8a90bc5c7aacbb7a6d483f7915c543367cc7c230 GIT binary patch literal 1281 zcmb7EOKTKC5bmCt-Au+Tnh2t(IH0I|$YKyZ1ku$P)XPF%MuwGU-0s~>GLN-;CLv2a z8P9t0D!a!VJqZ4mzIu@09}rJg%|7xlASvjYn(mtF@B6BIo|H-s0sFM~_4NyrkRSLm zGz)?%3^fam6OVApjgWdYe;S_ojBt}%yM$YUu3PU-uON!Nuwlsif_BGxgc5Enk#ezf z&q;+!SzE+B3$v)w-gcaoI7nTbR&Fzq?r_a*W^p48lDOjR!?vW>KtD7Cf+`Gk1DqfL zg?I+S*(ILY2jf}1z>Dx+;A614t;d#Olcg+bQ1}K7iy*f-80reRlyq}WJ>wnSAzfpK zav_nVVB>UHkBB;ro~C)z;_V z-+nIMDphM`Q=7n47u!Mx3D=XpQbMMW!zfYd{M*bA%Z9d;2%EYnh04Nok4PIJ{&_Sv zTVH`(RbS7-z^^|QY9meBb*{LWnQkNzU{+DJB(ZyZK0+j9s&Dw5J3{WwKQYIIHP1Io4v$6|pjl2`v`K(CHwa1$i9 zPAjoC)`EQ#Ak@m1p6F}1=m$zDJ-)o%7V}ajQeuKcf@La;7^9GVhdlITPF1B6bn8oU z9;Ov$p(Ga!kmb@5Sq|r(tjkUK_W!yJSl=F<8QjI)S`)F`lKy6pZo7eU?~IoB3s6>K z1AwqB!Baag{V+Qf(TC2$ ze#E_+ijP?^T%I*{`gs) zkiT(KJPr)*K~vv?;lwALa%)U|n)TMIw|zUCJHGP`;Wl?(67C3kSo_8H>!QJHBTGIM zbj}up5^n92PJQ;NtA)~mPL5P}dgM;!FxDU391L%E+^6wSd-zs){X}};;`P%w(!(TH zU3UqQki7_P@mMgp2TeTyBM3xAd)c*Y zN}d4;kIDDs2Xaj3jRiTej>()ITfDZgfCeX{;g0LA9z4&}gHU^bJ_=)R7)Me}M6A7R zqQ!xbrT5HLK%CM%Np*)BI~FgNDC6GD-q~?G8-}I8B9iDklO!7XwP~oMfw6{(Vfz}` zK6vzRT6h|#UvJ&dXl-mq*25o{u_ z3=DCu(`}2<*%nd)5_AifQVSFuQ!~@zO&Dl0hm>5<6ABz##~^*iu?-wMv)d(WxM783 zl}bTu%ghz(d2U}asTU@KE_<^6sI<#t8B zmCJgh7v|3NS&9J%?uMP zfsMPTkRT(kRUqXamqhgOd5AF9vyhfpT~7)~5=%uQZ|5P&)mef6qynX?&dOyymj6*% zA6C&wF%=vLv zkG+m-SP;bFLIbd2Lx5a3mwzma&&%Gc0bNAo(Gx6r(U=3O+WcUd;V3r*sU zivxv*QRcEn@sqv7vnSy&4g&c0G=hL9Q4mNhJ-=OiiMse9lJGAE$u3mGFzI$f_;TRx h@;xxd!A;ghVA$Op(U-Vs7KUR(Ae33mx_XDve*wHG2r>Ww literal 1862 zcmbVN%}>-o6rXue@mFb%p<}~uI(9L4bS8?R@>LbW3C<7Pl!gCzD3&g(Njlp zsi=w%ATS?f};4U0^ zIl|t6Pu>Ng$T7e@(Y|Ph?MQ1@4Vu2U&X@?lZ-DfbmMTCs36*1?!4oCe_^F_HUO!e?cl{0TqO}O zF&%9*UC^;OIlh>e`=Fllf^3w`7#TArFjE_?lvwe~3NtbZUG+HzhB8uQsW~>_-Z4gE zj2;0sq6TwnfQ6{Ts;vtPCSjvM5^{lL7KlJ|4t52i=6OVLd~HN8NR`jbp~#C<#BD$z*Z!43^XiB;}uYnZR%Sf#jD(t&w2@E4X_86cVK3 zYz0!TaV$c|C56Uvnk zB>0f~SnQa5QbBXwEfqYY&kw{6aK>xGs{Ee-^jf(Av>v?V$}G$ymfI|yLWEMQMl9FZ zY)_>&rI8hi@FlNaB*G)>XyX7YWTcManF@xe33d~e-2gPZrXDh6CfsGm~N}{ke z+nW4kC-`XS2N9)hE43(PahFohPT;o&GcNBdHm2By4?Pqw6WHxj6Rj?KFtyim-=Aak PO7y`rY~9vp7HsV=;=HT0 diff --git a/Week-3/__pycache__/toys.cpython-37.pyc b/Week-3/__pycache__/toys.cpython-37.pyc index dd4f2001d377922babb2dcc1bb5cde2d29caa64c..31fcface2031bb329e3846c0aced9d125aa882c3 100644 GIT binary patch literal 1084 zcmZuwPjAyO6t|tf%i6)vG_JWuXp<@=kPt$^xFPj2A*8A(>SC`AO_RuWHVtK`@?|)1 z;A8L=a^;k-z=`*qbRAGv{_~!n^ZR4>?Qj?nXg|OI__T5e`Gvuz*|2yGUF9%vG9jFD z_LWR1x3~>66P94yS<^M8guC2>oDDgfJKSG0lilM1WF5#tj_>!`0UtuvI2Srhiq&Ny_3Q!)t_!(L z^LZFtr+Tq1Jq;2H3b3)hpTVq-V5mXVV{%J1sf~=90yrDDcp##UQ_3{g5u4aovuxD3 zQm87^--twSem^^VG5w%~RMXE@md>W{gj(vNoN~p*=meORl?Fbe=|>@!Cr_unpvFq` zWQYu07zp*@Cvmx(<^Xm!G<$jy=@||YYv@c`o6zJWTqJ1%0Ewm0mCTPJR>&B!qz`k8 zClYi68wR*Gu5@rUy25G(ZqRXuWJwQd8hWu4&QjGXg#9hfK13~|-r-#OtnM)TzaRBVk~+-#xuF4K;Jfx3s6s#si!{5jMqVMH0v6Q5g>YjyLUH;2e!K+NXLeI?K#P<9>-yXQWec<^H^uTxj01TSLT>t<8 literal 893 zcmbtS&2H2%5Vn&|;!V4Sp5PcxXb-KlLgD}jA=+D|y;KNk6%?fzch~H05{(_IR@~ra zIPeaAjvV2{D{x}QP*_$%0%2+XWc&L*&-nRhlnPp(u0OtdJP_hD7dI=QWMQ#(pz`9UB(SA2bV^eBH}HQM}jw=!jZtnJb@Z4MUn$xoILcPYObE==YY8uh*DSoKL! zKvNZkA1?AFkXwiRN@P|367p0wczE9EN2;Ez8|YU0DSr;TM{W?QSS3o4r7HRc7m1yK diff --git a/Week-3/test_pendulum.py b/Week-3/test_pendulum.py index 1a4f9d0..ce361d3 100644 --- a/Week-3/test_pendulum.py +++ b/Week-3/test_pendulum.py @@ -5,7 +5,7 @@ ''' import unittest -import pendulum as pen +import test_pendulum as pen class TestSum(unittest.TestCase): def test_valid_input(self): diff --git a/Week-3/toys.py b/Week-3/toys.py index 4ae0057..e846d4f 100644 --- a/Week-3/toys.py +++ b/Week-3/toys.py @@ -10,16 +10,20 @@ # write a function that adds 1 # to the input and prints the result -def add(val1): +def inc(val1): result = val1 + 1 + print(result) return result -print(add(3)) + # write a function that adds 1 # to the input and returns the result def inc_return(a): - return # hint this is incomplete + result = a + 1 + return result # hint this is incomplete + +print(inc_return(3)) # write a function that adds @@ -28,6 +32,7 @@ def inc_return(a): def sum(a, b): result = a + b return result + print(sum(3, 4)) @@ -36,8 +41,9 @@ def sum(a, b): # sum() and then increments the sum # using inc_return def sum_inc(a, b): - result = sum(a + b) - inc_return result + result = sum(a, b) + result1 = inc_return(result) + return result1 print(sum_inc(4, 6)) @@ -47,7 +53,7 @@ def sum_inc(a, b): # boolean (True or False) for whether # the input number is even def is_even(a): - return + return a%2 == 0 # create for loop that takes a string @@ -59,6 +65,7 @@ def is_even(a): def string_repeat(phrase, repeat): # hint: you can add strings together # in order to concatenate them - return + result = (phrase * repeat) + return result -print("hi there!") \ No newline at end of file +print(string_repeat("hello", 3)) \ No newline at end of file diff --git a/Week-4/__pycache__/structures.cpython-37.pyc b/Week-4/__pycache__/structures.cpython-37.pyc index 023f056250017a983f23d313d15cb23cc351acd6..b2e6e52506274fa763d5e869011ca09922065503 100644 GIT binary patch literal 1440 zcmb7EOK;Oa5cVTZ95-o8`W75~q=$lnxPYn(DB^-tAyo*;3bI_!BsFzxYj<55R8I7V zaOKF~@s(5l0vDLsl47N*)ULfVvk%Yr&FrjSb-SKHZSVWfkA1R!@nF^*GG0)ZiUb&e z0VY^rLj#T;9B zIi+CB_-c~2NL%OTxizwgsC_V{Wn=n>+7B95t~$mrO{A)vVIoL1(um+)+N8zr-Tmi- z_Y#F1d@9o<8oWk%qVi$@60pA$=i{PO6jOij0r6z#>7d5Fm{g0}X&7Y?vfmE5l}%<~ zy7Y)HSuwNc#+oD2QE-r85M%Q|^VqgUo2IJv5ss29BgD$a4E_@p?7Qj|kx-$)QzDF8 zG$T1LhAEaw#@Z%>_034uC6be5fM@dnO9BgwR7kI0_sP`^qeu4DnXvzxG0dv*ITzRH zFBMTrZbd%Ekk=p9yszHDd*DjU6lO8b^IxeU%=SF4p{y~=E%QV*uTe0@e$bwIdomBX z7Ux+U5gY2^Y?pji16{uZXyrkoZ&V~Em3@MfdAN=~mk`gWsO8HV3YWueLlYacxpGdU zw7izWj-LGo@TLZE{|*53xx3>W$`tqbeD6s#1lJtf1A_Gf7Px+nQaMhBGe% zLOhUfh_~Rxj7z9VRjFNR_dmPdo!{(u_Vr-kJKVng{PE#?&vAaqWYwB%yyR|9c>pJL zpaIP9 zr6RHgp?Q`seg7<8+97l4bHWRqu_LDFL(ml>Y(N- z2>htQAxjgLe$3spd6+rOZk&AOq4ewpswC#4vZWe+9~~b~-Wen_`B)^ep1eUbw^=>` z132D~vPE84j%Pf1k2v2ynAEuWvfP};WUSIDs6-pPAyi4D(;$IIEwQV&ox;^c*()y9zo~Jd6RQ`SQ#I;&cFv4-zTX}oFj(iklX{0$C?rOEm9Mqsv68D9cKE%~a(6lUD zb6l?D`qh6?c*Qkrj%t+62T-Wbn@jgnC&jH4_N&#ufLArZ)&l_H#?3Xx^~tUD?JSUH zsQzt_(Y&oex7j`!`DIrr$ReexH$_tJB=tyAHY9(QB+Dd8APJP@U@do2tJiPHJ6dE= YB>2MRC9}gryW{n|uIF+0d2~JZ53>;iOaK4? diff --git a/Week-4/structures.py b/Week-4/structures.py index 461415c..f4de5cc 100644 --- a/Week-4/structures.py +++ b/Week-4/structures.py @@ -8,8 +8,14 @@ # write a function that returns a list containig the first and the last element # of "the_list". -def first_and_last(the_list): - return [] +the_list = [1, 2, 3, 4, 5] + +def first_and_last(the_list =[1,2,3]): + first = the_list[0] + last = the_list[-1] + return [first, last] + +print(first_and_last(the_list)) # write a function that returns part of "the_list" between indices given by the @@ -18,6 +24,8 @@ def first_and_last(the_list): # If "end" is greater then "beginning" or any og the indices is out of the # list, raise a "ValueError" exception. def part_reverse(the_list, beginning, end): + beginning = 1 + end = 5 return # hint this is incomplete From 4fbcc6fa4c42f5948282793ed2b0d179db171a75 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Sat, 26 Oct 2019 02:24:23 +0100 Subject: [PATCH 13/16] halfway there --- Week-4/structures.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Week-4/structures.py b/Week-4/structures.py index f4de5cc..9e47bc3 100644 --- a/Week-4/structures.py +++ b/Week-4/structures.py @@ -23,25 +23,42 @@ def first_and_last(the_list =[1,2,3]): # reverse order than in the original "the_list". # If "end" is greater then "beginning" or any og the indices is out of the # list, raise a "ValueError" exception. -def part_reverse(the_list, beginning, end): - beginning = 1 - end = 5 - return # hint this is incomplete +def part_reverse(): + the_list = [1, 2, 3, 4, 5] + beginning = the_list[0] + end = the_list[-1] + result = (end, beginning) + try: + if end > beginning: + print("This should be the case") + else: + print("Please check the code again!") + except ValueError as err: + print("there is a ValueError!") + return result + #the_list, beginning, end +print(part_reverse()) +# hint this is incomplete # write a function that at the "index" of "the_list" inserts three times the # same value. For example if the_list = [0,1,2,3,4] and index = 3 the function # will return [0,1,2,3,3,3,4]. def repeat_at_index(the_list, index): - return + the_list.insert(the_list.index(index), index) + the_list.insert(the_list.index(index), index) + return the_list + +list1 = [1, 2, 3, 4, 5] +ind1 = 2 + +print(repeat_at_index(list1, ind1)) # Strings # write a function that checks whether the word is a palindrome, i.e. it reads # the same forward and backwards -def palindrome_word(word): - return # write a function that checks whether the sentence is a palindrome, i.e. it # read the same forward and backward. Ignore all spaces and other characters From e468794e13aa1b78667081b64ff478761c98116e Mon Sep 17 00:00:00 2001 From: Julian syn Date: Mon, 28 Oct 2019 13:05:02 +0000 Subject: [PATCH 14/16] tried --- Week-4/structures.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Week-4/structures.py b/Week-4/structures.py index 9e47bc3..1502a28 100644 --- a/Week-4/structures.py +++ b/Week-4/structures.py @@ -64,9 +64,16 @@ def repeat_at_index(the_list, index): # read the same forward and backward. Ignore all spaces and other characters # like fullstops, commas, etc. Also do not consider whether the letter is # capital or not. -def palindrome_sentence(sentence): +def palindrome_sentence(): + sentence = "lolol" + if sentence == sentence.reverse(): + print: ("this is a palindrome") + else: + print("this is not a palindrome") return +print(palindrome_sentence()) + # write a function that concatenates two sentences. First the function checks # whether the sentence meets the following criteria: it starts with a capital # letter and it ends with a full stop, question mark, or an exclamation point. From e77c470c87050f1b1863d8d5edf5d3e5ecd0c093 Mon Sep 17 00:00:00 2001 From: Julian syn Date: Mon, 28 Oct 2019 15:35:53 +0000 Subject: [PATCH 15/16] tried --- Week-4/structures.py | 58 ++++++++++++++++++++++++++++++++------- Week-4/test_structures.py | 47 +++++++++++++------------------ 2 files changed, 67 insertions(+), 38 deletions(-) diff --git a/Week-4/structures.py b/Week-4/structures.py index 1502a28..6899dd9 100644 --- a/Week-4/structures.py +++ b/Week-4/structures.py @@ -37,8 +37,7 @@ def part_reverse(): print("there is a ValueError!") return result #the_list, beginning, end -print(part_reverse()) -# hint this is incomplete +print(part_reverse()) # hint this is incomplete # write a function that at the "index" of "the_list" inserts three times the @@ -59,18 +58,26 @@ def repeat_at_index(the_list, index): # write a function that checks whether the word is a palindrome, i.e. it reads # the same forward and backwards +def palindrome_word(): + word = "hello" + if word == word[::-1]: + print("this is a palindrome") + else: + print("this is not a palindrome") + return None +print(palindrome_word()) # write a function that checks whether the sentence is a palindrome, i.e. it # read the same forward and backward. Ignore all spaces and other characters # like fullstops, commas, etc. Also do not consider whether the letter is # capital or not. def palindrome_sentence(): - sentence = "lolol" - if sentence == sentence.reverse(): - print: ("this is a palindrome") + sentence = "hello olleh" + if sentence == sentence[::-1]: + print("this is a palindrome") else: print("this is not a palindrome") - return + return print(palindrome_sentence()) @@ -81,23 +88,54 @@ def palindrome_sentence(): # the end. The concatenated sentence must have no white space at the beginning # or at the end and the must be exactly one space after the end of the first # sentence. -def concatenate_sentences(sentenece1, sentence2): +def concatenate_sentences(): + sentence1 = "Hi my name is Julian." + sentence2 = " I am 21 yrs old" + if sentence1.capitalize() and "." or "?" or "!" in sentence1: + print(sentence1 + sentence2) return +print(concatenate_sentences()) + # Dictionaries # write a function that checks whether there is a record with given key in the # dictionary. Return True or False. def index_exists(dictionary, key): - return + for keyy in dictionary.keys(): + if keyy == key: + return True + else: + continue + return False + +print(index_exists({"name": "cock", +"age": "sucker", +"home": "youre mums house" +},"name")) # write a function which checks whether given value is stored in the # dictionary. Return True or False. def value_exists(dictionary, value): - return + for valuee in dictionary.values(): + if valuee == value: + return True + else: + continue + return False + +print(value_exists({"name": "cock", +"age": "sucker", +"home": "youre mums house" +},"cock")) # write a function that returns a new dictionary which contains all the values # from dictionary1 and dictionary2. def merge_dictionaries(dictionary1, dictionary2): - return + '''Combines two dictionaries''' + dict1 = dictionary1 + for key,value in dictionary2.items(): + dict1[key] = value + return dict1 + diff --git a/Week-4/test_structures.py b/Week-4/test_structures.py index 1d54815..b05b746 100644 --- a/Week-4/test_structures.py +++ b/Week-4/test_structures.py @@ -1,6 +1,5 @@ ''' -test_toys.py - +test_structures.py Unit tests for structures functions. ''' @@ -11,7 +10,7 @@ import structures as st -class TestSum(unittest.TestCase): +class TestStructures(unittest.TestCase): def set_up(self): pass @@ -23,7 +22,7 @@ def test_first_and_last(self): result = st.first_and_last([0,1,2,3]) self.assertEqual(result, [0,3]) - def test_part_reverse(selff): + def test_part_reverse(self): ''' Test ''' @@ -41,51 +40,51 @@ def test_palindrome_word1(self): ''' Test palindrome word ''' - resutl = st.palindrome_word("madam") - self.asserIs(result, True) + result = st.palindrome_word("madam") + self.assertIs(result, True) def test_palindrome_word2(self): ''' Test palindrome word ''' - resutl = st.palindrome_word("Madam") - self.asserIs(result, True) + result = st.palindrome_word("Madam") + self.assertIs(result, True) def test_palindrome_word3(self): ''' Test palindrome word ''' - resutl = st.palindrome_word("palindrome") - self.asserIs(result, False) + result = st.palindrome_word("palindrome") + self.assertIs(result, False) def test_palindrome_sentence1(self): ''' Test palindrome sentence ''' - resutl = st.palindrome_word("Was it a car or a cat I saw") - self.asserIs(result, True) + result = st.palindrome_sentence("Was it a car or a cat I saw") + self.assertIs(result, True) def test_palindrome_sentence2(self): ''' Test palindrome sentence ''' - resutl = st.palindrome_word("Random sentence") - self.asserIs(result, False) + result = st.palindrome_sentence("Random sentence") + self.assertIs(result, False) def test_palindrome_sentence3(self): ''' Test palindrome sentence ''' - resutl = st.palindrome_word(" Do geese see God ") - self.asserIs(result, True) + result = st.palindrome_sentence(" Do geese see God ") + self.assertIs(result, True) def test_concatenate_sentences1(self): ''' Test sentence concatenation ''' result = st.concatenate_sentences("First sentence.", "Second sentence.") - self.assertEquual(results, "First sentence. Second sentence.") + self.assertEqual(result, "First sentence. Second sentence.") #def test_concatenate_sentences2(self): # ''' @@ -101,12 +100,6 @@ def test_index_exists1(self): result = st.index_exists({"ind1": "val1", "ind2": "val2"} , "ind1") self.assertIs(result, True) - def test_index_exists2(self): - ''' - Test - ''' - result = st.index_exists({"ind1": "val1", "ind2": "val2"} , "ind3") - self.assertIs(result, False) def test_value_exists1(self): ''' @@ -127,11 +120,9 @@ def test_merge_dictionaries(self): ''' Test ''' - result = st.merge_dictionaries({"a": 1, "c": 3}, {"b:" 2, "d": 4}) - self.assertEqual(result, {"a": 1, "c": 3, "b:" 2, "d": 4}) - - + result = st.merge_dictionaries({"a": 1, "c": 3}, {"b": 2, "d": 4}) + self.assertEqual(result, {"a": 1, "c": 3, "b": 2, "d": 4}) if __name__ == '__main__': - unittest.main() + unittest.main() \ No newline at end of file From 6544ba814706554055868f22e794115496750d22 Mon Sep 17 00:00:00 2001 From: julian syn Date: Thu, 21 Nov 2019 12:21:35 +0000 Subject: [PATCH 16/16] removed --- test week 2/class.py | 9 --------- yummy.py | 11 ----------- 2 files changed, 20 deletions(-) delete mode 100644 test week 2/class.py delete mode 100644 yummy.py diff --git a/test week 2/class.py b/test week 2/class.py deleted file mode 100644 index adb13d1..0000000 --- a/test week 2/class.py +++ /dev/null @@ -1,9 +0,0 @@ -Print("hello there!") - -number = int(input('please guess a number: ')) -if number == 4: - print('you guessed it!, good job') -else: - print('better luck next time!') - - diff --git a/yummy.py b/yummy.py deleted file mode 100644 index db330a8..0000000 --- a/yummy.py +++ /dev/null @@ -1,11 +0,0 @@ -print("hello there!") - -print("I want to learn html and Java now.") - -words = ("bad", "badminton", "badass", "good", "happy", "joy") - -for item in words: - if "bad" in item: - continue - else: - print(item) \ No newline at end of file