14. לוגים אופרטורים:אמת טבלאות
A B A and B A or B Not A
3<1 (False) 2<1 (False) False False True
3<1 (False) 2>1(True) False True True
3>1(True) 2<1 (False) False True False
3>1(True) 2>1(True) True True False
102. לולאת היא מהwhile?
•מטאפורה:במבה שקית עם אדם בן
•יש בשקית40במבה יחידות,אותה לאכול ורוצה במבה מוציא אדם הבן
•בלולאת נמצא היא כאילו אדם בן על להסתכל אשפרwhile
1. number of bambas = 40
2. while number of bambas >0
3. take one bamba
4. eat bamba
5. go to step 2
6. put the empty bag away
103. לולאת היא מהwhile?
•מטאפורה:במבה שקית עם אדם בן:
•יש בשקית40במבה יחידות,בלולאת נמצא אותה לאכול ורוצה במבה שאוהב אדם בןwhile
1. number of bambas = 40
2. while number of bambas >0:
3. take one bamba
4. eat bamba
5. go to step 2
6. put the empty bag away
104. Python while loop
• while expression:
• statement
• statement
• statement
• print “not inside while”
•לולאתwhileשלה ביטוי של שתנאי עד מתבצעתערך בעלTrue
בלוק
של
WHILE
105. לולאת היא מהwhile?
•מטאפורה:במבה שקית עם אדם בן
•יש בשקית40במבה יחידות,בלולאת נמצא אותה לאכול ורוצה במבה שאוהב אדם בןwhile
1. number of bambas = 40
2. while number of bambas >0:
3. take one bamba
4. eat bamba
5. go to step 2
6. put the empty bag away
106. לולאת היא מהwhile?
•מטאפורה:במבה שקית עם אדם בן
•יש בשקית40במבה יחידות,בלולאת נמצא אותה לאכול ורוצה במבה שאוהב אדם בןwhile
• http://www.codeskulptor.org/#user42_W4G04OOmnx_0.py
1. number of bambas = 40
2. while number of bambas >0:
3. take one bamba
4. eat bamba
5. go to step 2
6. put the empty bag away
algorithm
program
140. Algorithm of Babylonian Method
1. Given input X
2. Y = some initial guess for square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y
142. לתוכנה אלגוריתם תרגום
• http://www.codeskulptor.org/#user42_8QlK9bVtEO_0.py
1. Given input X
2. Y = some initial guess for
square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y
143. לתוכנה אלגוריתם תרגום
• http://www.codeskulptor.org/#user42_8QlK9bVtEO_0.py
1. Given input X
2. Y = some initial guess for
square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y
144. לתוכנה אלגוריתם תרגום
• http://www.codeskulptor.org/#user42_8QlK9bVtEO_8.py
1. Given input X
2. Y = some initial guess for
square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y
145. לתוכנה אלגוריתם תרגום
• http://www.codeskulptor.org/#user42_8QlK9bVtEO_8.py
1. Given input X
2. Y = some initial guess for
square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y
183. לולאת היא מהwhile?
•מטאפורה:במבה שקית עם אדם בן:
•יש בשקית40במבה יחידות,בלולאת נמצא אותה לאכול ורוצה במבה שאוהב אדם בןwhile
1. number of bambas = 40
2. while number of bambas >0:
3. take one bamba
4. eat bamba
5. go to step 2
6. put the empty bag away
185. לתוכנה אלגוריתם תרגום
• http://www.codeskulptor.org/#user42_8QlK9bVtEO_8.py
1. Given input X
2. Y = some initial guess for
square root of X
3. Calculate Z=|Y^2-X|
4. while (Z is not small enough)
5. Y=(Y+X/Y)/2
6. Z=|Y^2-X|
7. print Y