{%hackmd BJ-DJz7nt %} # Bare Bears S3C6: Teaching For loop time -Part 2 ###### tags: `Programming` `CS` `Python` `CWL` ![Alt](https://media.giphy.com/media/MDXomrcGshGso/giphy.gif) ## How to change the world! ![](https://hackmd.io/_uploads/Hyo1Xj_Wc.jpg) ``` change the world -> change your heart -> change your perspective -> change your action -> every time you face a realm, stay mindfulness -> every time you face a realm, observe your afflictions(negative thought) nagative thought: your math is bad -> what is the definition of having a bad math ``` ## Homework Review ### Practices ==Learn to explain the questions and your code to others== You need to prepare your code and practice your explanation at home. And, you will explain the question, your solving logic, and your code in class ^^ - Jason :[Adding Factorials](https://snakify.org/en/lessons/for_loop_range/problems/sum_of_factorials/) - Janet : [Ladder](https://snakify.org/en/lessons/for_loop_range/problems/ladder/) - Sophia: [Series - 2](https://snakify.org/en/lessons/for_loop_range/problems/series_2/) ==Programming Questions== **Q1. First N even, descending** Given an integer N, print all the even numbers from 0 to N in descending order. - Input > test 1: 8 > test 2: 11 - Output > test 1: 8, 6, 4, 2, 0 > test 2: 10, 8, 6, 4, 2, 0 **Q2. Squares in range** Given two integers A and B, print squares of all integer numbers between them, as shown below. There shouldn't be any spaces around * and =. The sep argument of the function print() may help you with that. ![](https://i.imgur.com/7cEz1Qq.png) ### OMAK - Audio file - OMAK notes(just as usual) Record one of your past memory in the past, and tried to do the OMAK to it using your personal style ^^ ## Homework ### Practices ==Learn to explain the questions and your code to others== Janet please explain "Ladder" problem to Sophia, and we will let Sophia to explain the "logic of her code", and "the actual code in the class." ==Programming Questions== **Add Primes in range** Add up all the prime numbers in the range - Input > test 1: 5, 10 > test 2: 5, 20 - Output > test 1: 12 > test 2: 72 ```python= ans = 0 for num in range(5, 11): primeflag = 1 # check if it is the prime number for divisor in range(2, num): if (num%divisor == 0): #print(num, divisor) primeflag = 0 #print("="*8) if primeflag == 1: ans = ans + num #print(num , ans) print(ans) ``` ### OMAK #### Writing an OMAK of your sibilings - Your good deeds toward him/her - Her good deeds toward you/others - A lovely memory with a picture #### New way of storytelling - Story Audio file upload to youtube - Play it using livecoding {%youtube MtX7BP-GueQ %} ``` create(2,2,"MtX7BP-GueQ") // youtube id is pasted when you click a thumbnail mute(3, 1) volume(1,10) loopAt(3,100,10) cue(2,"_SVxbdQR6Eg") cue(2,"A9BG-vSSlZk") cue(3, "OoIa253WD7s") mute(2,1) ```