User:Bohye Woo/Prototyping 02: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 1: Line 1:
[[File:Python if else.png|frameless|right]]
* import time
* import time
<source lang=python>
<source lang=python>
import time
import time
Line 26: Line 29:


</source>
</source>
[[File:Python if else.png|thumbnail|right|Python if, elif, else]]

Revision as of 16:28, 21 January 2019

Python if else.png
  • import time
import time

l = ["1111111", "2", "3122", "4", "5"] # [0]. [1], [2], [3], [4]
i = 0
[[File:Python if else.png|frameless|right]]

while True:

	for person in l:
		if len(person) > 4: # if the length of [0] item is bigger than 4 
			print(person, "bigger than") 

		elif len(person) == 4:
			print("4")

		else:
			print(person, "smaller than")

		time.sleep(0.1)
		
	print('looping', i)
	i = i + 1
	time.sleep(1)