← கட்டுரைக்குத் திரும்பு

"PDF பதிவிறக்கு" அழுத்தியதும் Destination → Save as PDF தெரிவு செய்யுங்கள். Phone-இல்: Share/Print → Save as PDF.

NST Campus
NST Campus · Nintavur இலவச Worksheet · nstcampus.edu.lk/blog

Python Tracing பயிற்சித்தாள் (8 programs + விடைகள்)

பெயர்: தரம்: திகதி:

ஒவ்வொரு program-க்கும் trace table வரைந்து, அதன் output-ஐ எழுதவும். நேரம்: 45 நிமிடங்கள்.

1.

x = 5
y = 3
x = x + y
y = x - y
x = x - y
print(x, y)

Output:

2.

total = 0
for i in range(1, 5):
    total = total + i
print(total)

Output:

3.

count = 0
num = 1
while num < 20:
    num = num * 3
    count = count + 1
print(count, num)

Output:

4.

marks = [45, 78, 62, 90, 33]
passed = 0
for m in marks:
    if m >= 50:
        passed = passed + 1
print(passed)

Output:

5.

word = "ICT"
result = ""
for ch in word:
    result = ch + result
print(result)

Output:

6.

a = 10
b = 4
print(a // b, a % b, a / b)

Output:

7.

nums = [4, 9, 2, 7]
big = nums[0]
for v in nums:
    if v > big:
        big = v
print(big)

Output:

8.

s = 0
for k in range(2, 11, 2):
    s = s + k
print(s)

Output:

போனஸ் — பிழையைக் கண்டுபிடி

for i in range(5)
    print(i)

பிழை என்ன? திருத்தி எழுதுக:

Trace tables-க்கான இடம்

விடைகள் (Answer Key)

  1. 3 5 (x, y மாற்றப்பட்டன)
  2. 10
  3. 3 27
  4. 3
  5. TCI
  6. 2 2 2.5
  7. 9
  8. 30

போனஸ்: range(5)-க்குப் பின் colon (:) இல்லை → for i in range(5): — output 0 முதல் 4 வரை.