የ12ኛ ክፍል የመረጃ ቴክኖሎጂ ምዕራፍ 6
range(): where it starts, stops and steps
4 ደቂቃ · የተሠሩ 2 ያለፉ የፈተና ጥያቄዎች
የትምህርቱ ክፍሎች
ትምህርቱን ከዚያ ጀምሮ ለማጫወት አንድ ክፍል ይንኩ።
የ12ኛ ክፍል የመረጃ ቴክኖሎጂ ምዕራፍ 6 የ4 ደቂቃ የ Temari ቪዲዮ ትምህርት፦ range(): where it starts, stops and steps። 2 ያለፉ የፈተና ጥያቄዎችን ደረጃ በደረጃ ይሠራል። በነጻ ይታያል፤ መለያ አያስፈልግም። ትምህርቱ በእንግሊዝኛ ነው።
ስለ ምዕራፍ 6 ተጨማሪ
የምዕራፉ ገጽ Temari በዚህ ምዕራፍ ላይ ያለውን ሌላውን ይዟል፤ ለምሳሌ አጭር ማስታወሻዎችና የመልመጃ ጥያቄዎች ከመልሶቻቸው ጋር።
የምዕራፍ 6 ገጽ ይክፈቱትምህርቱ የሚናገረው ሁሉ
የትምህርቱ ቃላት በየክፍሉ። ትምህርቱን ከዚያ ጀምሮ ለማጫወት ሰዓቱን ይንኩ።
0:00Introduction
In Python, a for loop with range counts for you. But range has one habit that trips students up: it never reaches the number you tell it to stop at. Learn its three forms, and you can write out any sequence without running the code.
0:17A for loop counts with range
First, the loop. A loop repeats a block of statements. A for loop takes each value of a sequence in turn. Here: for i in range five, colon. The print statement is indented under it, because Python uses indentation to mark the block.
Range gives the loop its numbers. With one number, range starts at zero, counts up by one, and stops before that number. So range five gives zero, one, two, three, four. That is five values, but never five itself.
0:53Two numbers: a start
Give range two numbers, and the first one is the start. Range two, five starts at two and stops before five: two, three, four. The start is included. The stop is not.
A quick check: how many numbers? Take the stop minus the start. Five minus two is three, and there are three numbers. For range five, the start is zero: five minus zero is five numbers.
1:23Practice question 1ያለፈ ፈተና
Here is a practice question. What sequence of numbers is generated by the Python expression, range(5)? Pause the video, and try it.
With one number, range starts at zero, and it stops before five. So: zero, one, two, three, four. The answer is C. A goes one step too far, to five. B starts at one, but the start is zero. And D also starts at one, so it loses the zero.
2:00Three numbers: a step
Now give range three numbers. The third is the step: how much it adds each time. Range one, ten, two starts at one and adds two each time: one, three, five, seven, nine.
The next number would be eleven. But the stop is ten, and the loop never goes past the stop. So the list ends at nine. Range ten, one hundred, ten would give ten, twenty, and so on up to ninety.
2:34Practice question 2ያለፈ ፈተና
Try this one. What list of numbers is generated by the function, range(1, 10, 2)? Pause, and try it.
Start at one. Add two each time: one, three, five, seven, nine. Eleven would be next, but the stop is ten, so the list ends at nine. The answer is B. A forgets the step, and reaches the stop. C starts at two, but the start is one. And D runs on to eleven, past the stop.
3:12Summary
So remember. Range always stops before the stop number. With one number, it starts at zero. With two, the first one is the start. With three, the third one is the step. Keep practising questions like these on Temari.et.
ይህን ምዕራፍ በመተግበሪያው ይለማመዱ
Temari ይህን ምዕራፍ ወደ ጊዜ የተቆረጠለት መልመጃ ይለውጠዋል፣ እየሠሩ ያርምዎታል፤ ያልገባዎትንም የሚያብራራ የ AI አስተማሪ አለ።
በነጻ ይጀምሩTemari.et ለ Android ስልኮች መተግበሪያ አለው፤ በ Google Play ላይ በነጻ ይገኛል።

