Skip to content

Commit 20c911e

Browse files
committed
Update funcWithStrsAndConds.ptx
1 parent 1151d5c commit 20c911e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

pretext/functions/funcWithStrsAndConds.ptx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,35 @@ class myTests(TestCaseGui):
618618
self.assertEqual(test(10),True,"test(10)")
619619
self.assertEqual(test(9),True,"test(9)")
620620

621+
myTests().main()
622+
</input>
623+
</program>
624+
</exercise>
625+
<exercise label="fsc_ac_or_complex_cond">
626+
<statement>
627+
<p>Modify this code to use a complex conditional instead. It should still pass all tests. It should only take four lines of code or less.</p>
628+
</statement>
629+
<program xml:id="fsc_ac_or_complex_cond_editor" interactive="activecode" language="python">
630+
<input>
631+
# function definition
632+
def either6(a,b):
633+
if a == 6:
634+
return True
635+
if b == 6:
636+
return True
637+
return False
638+
639+
====
640+
from unittest.gui import TestCaseGui
641+
642+
class myTests(TestCaseGui):
643+
644+
def testOne(self):
645+
self.assertEqual(either6(5,2),False,"either6(5,2)")
646+
self.assertEqual(either6(6,3),True, "either6(6,3)")
647+
self.assertEqual(either6(3,6),True, "either6(3,6)")
648+
self.assertEqual(either6(3,-6),False, "either6(3,6)")
649+
621650
myTests().main()
622651
</input>
623652
</program>

0 commit comments

Comments
 (0)