{%hackmd BJ-DJz7nt %} # Bare Bears S3C3: For Loop Full Review ###### tags: `Programming` `CS` `Python` `CWL` ## Setting your 2022 goal 🕊️ ![](https://hackmd.io/_uploads/SJyu9O7kc.jpg =400x350) - ==New Year Reflection & Looking forward 🕊️== - What's your growth in these 4 months - What have you done well in these 4 months - Why do you think you are able to do well and grow happier and positively - Setting your 2022 goals! ## How to be a happier person 😇 子曰:「其為人也孝弟,而好犯上者,鮮矣;不好犯上,而好作亂者,未之有也。君子務本,本立而道生。孝弟也者,其為仁之本與!」 > Yu Tzu* said: 'It is rare for a man whose character is such that he is good as a son and obedient as a young man to have the inclination to transgress against his superiors; it is unheard of for one who has no such inclination to be inclined to start a rebellion. The gentleman devotes his efforts to the roots, for once the roots are established, the Way will grow therefrom. Being good as a son and obedient as a young man is, perhaps, the root of a man's character.' ## Python: For loop with range 🤖 ![](https://hackmd.io/_uploads/Hkm6HXmrF.png =480x250) - [x] Lost card (homework review) ## Homework ### Print primes in range A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Given two integers A and B, print all prime numbers between them, inclusively. - Input > 5, 20 - Output > 5, 7, 11, 13, 17, 19 ```python= startNum = 45 endNum = 100 prime = 1 # Ex. num = 7 for num in range(startNum, endNum+1): prime = 1 # divisor = 2, 3, 4, 5, 6 for divisor in range(2, num): if num%divisor == 0: prime = 0 # print the prime if prime: print(num) ``` ### First N even, descending Given an integer N, print all the even numbers from 0 to N in descending order. - Input > 9, - Output > 8 6 4 2 0 ```python= a = int(input()) for loop in range(a-1, -1, -2): print(loop) ``` ### OMAK: Observe merits and appreciate kindness ==Everyday OMAKingggg== Here is the explaination for [OMAK](https://hackmd.io/@kuangkao-peace/OMAK). Please pick 1 day to write it. Create a note in HackMD, and write it down ^^