Lesson 16 of 34

Lists: பல மதிப்புகள் ஒரே இடத்தில்Lists: Many Values in One Place

9 min 25 XP

ஒரு வகுப்பில் 40 மாணவர்களின் மதிப்பெண்களுக்கு 40 variables வேண்டாம்! list என்பது பல மதிப்புகளை வரிசையாக வைக்கும் ஒரு பெட்டி. [ ] அடைப்புக்குறிக்குள் , பிரித்து எழுதுங்கள்.

You don't need 40 variables for 40 students' marks! A list holds many values in order. Write them inside [ ] separated by commas.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

Index மூலம் ஒரு மதிப்பை மாற்றலாம். slicing [start:stop] மூலம் list-ன் ஒரு பகுதியைப் பெறலாம் (stop சேர்க்கப்படாது).

You can change an item using its index. Slicing [start:stop] gives part of a list (stop is not included).

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

for loop மூலம் list-ன் ஒவ்வொரு மதிப்பின் மீதும் செல்லலாம்.

A for loop visits every item in a list.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

list-ல் வெவ்வேறு வகை மதிப்புகளையும் வைக்கலாம்: [1, "two", 3.0, True]

A list can mix types: [1, "two", 3.0, True]

Challenge

+25 XP

marks = [78, 92, 65, 88]. முதல் மதிப்பெண், கடைசி மதிப்பெண், மொத்த மதிப்பெண்களின் எண்ணிக்கை ஆகியவற்றை தனித்தனி வரிகளில் print செய்யுங்கள்.

marks = [78, 92, 65, 88]. Print the first mark, the last mark and how many marks there are, each on its own line.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.