Functions:
Question 1:
Create a function that checks if a number is even or odd.
Question 2:
Create a function that calculates the area of a rectangle.
Question 3:
Create a function to find the sum of all elements in a list.
File Handling:
Question 1:
[Link] contains a list of integers.
Write a program to implement these requirements:
Read the integers from [Link].
Identify and count how many of them are even.
Write the even numbers to [Link].
The program must:
Use loops to process the file data.
Write only the even numbers into [Link].
Question 2:
[Link] contains a list of words.
Write a program to implement these requirements:
Read each word from [Link].
Check if the word contains more than 5 characters.
Print all words longer than 5 characters to the screen.
The program must:
© Eng. Dina Abdulrasoul
Use loops to process the words in the file.
Only print words that satisfy the condition.
Question 3:
[Link] contains daily temperature readings in Celsius.
Write a program to implement these requirements:
Read each temperature from [Link].
Identify any readings below 0°C and count them.
Write these sub-zero readings to [Link].
The program must:
Use loops to process the temperatures.
Write only the readings below 0°C into [Link].
© Eng. Dina Abdulrasoul