You are on page 1of 3

Amman Baptist School IGCSE Department

Monday 4/12/2023 IT- Final Submission- Python


10th Grade B Teacher: Navy Hattar
Name:____________________
_

1- Write a program that asks the user for a number then prints the following sentence that number of
times: ‘I am back to check on my skills!’ If the number is greater than 10, print this sentence
instead: ‘Python conditions and loops are a piece of cake.’ Assume you can only pass positive
integers.

2- Below is a string "ABgvddVICJSdkeprsmgnUTPDvndhtuwPOTNRSjfisuRNSUesajdsa" It contains


a long string of characters. Your task is to iterate over the characters of the string, count uppercase
letters and lowercase letters, and print the result:

Page 1/3 Turn Over >


3- Create a function named is_triangle_possible() that accepts three positive numbers. It should return
True if it is possible to create a triangle from line segments of given lengths and False otherwise.
With 3 numbers, it is sometimes, but not always, possible to create a triangle: You cannot create a
triangle from a = 13, b = 2, and c = 3, but you can from
a = 13, b = 9, and c = 10.

4- Create two functions: print_five_times() and speak(). The function print_five_times() should
accept one parameter (called sentence) and print it five times. The function speak(sentence, repeat)
should have two parameters: sentence (a string of letters), and repeat (a Boolean with a default value
set to False). If the repeat parameter is set to False, the function should just print a sentence once. If
the repeat parameter is set to True, the function should call the print_five_times() function.

Page 2/3 Turn Over >


5- Write a function called find_greater_than() that takes two parameters: a list of numbers and an
integer threshold. The function should create a new list containing all numbers in the input list
greater than the given threshold. The order of numbers in the result list should be the same as in the
input list. For example:

find_greater_than([-3, 2, 8, 15, 31, 5, 4, 8], 5)


[8, 15, 31, 8]

6- Create a function find_short_long_word(words_list). The function should return a tuple of the


shortest word in the list and the longest word in the list (in that order). If there are multiple words
that qualify as the shortest word, return the first shortest word in the list. And if there are multiple
words that qualify as the longest word, return the last longest word in the list.

For example, for the following list:

words = ['go', 'run', 'play', 'see', 'my', 'stay']

the function should return

('go', 'stay')

Assume the input list is non-empty.

Page 3/3 Turn Over >

You might also like