Page 138 - Trackpad_V1_Book 8_Flipbook
P. 138
LAB ACTIVITY Computational Thinking
Visit your computer lab and perform the following actions:
In the list given below, use functions to edit it and only display numbers that are divisible by 4.
If there is a number greater than 100, then stop the loop iteration.
list = [8, 13, 16, 24, 35, 50, 60, 72, 75, 100, 120, 160]
Write a program that counts the total number of digits in the number 542892 and displays it
as output.
Reverse the list given below using for loop. list = [25, 35, 45, 55, 65, 75]
Type your name in Python and make the first and the last letter of your name uppercase and
let the other letters remain lowercase.
COding Zone COding Zone {} = COding Zone Computational Thinking
{C ding z ne}
[]
</>
COding Zone
Find errors in the code of the programs given below, correct them and write the output.
1. def rev_sentence(sentence) ;
words – sentence.split[‘ ’]
reverse_sentence = ‘ ’.join(reversed(words))
return reverse_sentence
if _name_ == “__main__” :
input = “Today is Sunday”
print (rev_sentence[input])
2. total: 0
list1 = (25, 15, 10, 5)
for ele in range[0, len(list1)):
total = total + list1[ele]
print(“Sum of all elements in given list: ”, total)
CAREER HERE
People who are experts in Python may pursue their careers as software developer.
FOR THE TEACHER
Demonstration of creating functions to the students.
Explain List and String in detail to the students.
136 Trackpad (Version 1.0)-VIII

