spis2022.github.io

SPIS, FOCS, 10.15, 0804

Testing

Using pytest with repl.it: step-by-step, with animation

Important to know:

animation of pytest demo

Here’s a repl that you can “fork” to play with this code for yourself:

@phtcon/spis2022-FOCS-0804

Strong Style Pairing

Strong Style Pairing

While loops

Here is an example of rewriting the first_factor_found function using a while loop instead of a for loop

@PhillipConrad/spis2022-FOCS-0804

Some notes on while loops:

while condition:
   do_something()
   do_something_else()

A more specific example:


i=1;
while i<10:
  print("i=",i)
  i+=1
  

Here’s the output:

i= 1
i= 2
i= 3
i= 4
i= 5
i= 6
i= 7
i= 8
i= 9