Académique Documents
Professionnel Documents
Culture Documents
2. Ask the user for a number (3 digit integer). Print out an appropriate message to the user,
depending on whether the number is even or odd.
3. Create a program that asks the user for a number and then prints out a list of all the divisors of
that number in increasing order.
4. Write a program to find the L.C.M. of any two numbers entered by the user.
5. Write a python program which takes as an input the examples of 3 strings and print out whether
those strings are palindrome or not. (A palindrome is a string that reads the same forwards and
backwards. Example: MADAM).
6. Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input),
compare them, print out a message of congratulations to the winner, and ask if the players want
to start a new game)
7. Write a program to find all Armstrong number in the range of 0 and 999.
(An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is
equal to the number itself. For example, 371 is an Armstrong).
8. Write a program that takes a list and returns a new list that contains all the elements of the first
list minus all the duplicates.
9. Write a program that asks the user how many Fibonacci numbers to generate and then generates
them. Take this opportunity to think about how you can use functions. Make sure to ask the user
to enter the number of numbers in the sequence to generate. (Hint: The Fibonnaci seqence is a
sequence of numbers where the next number in the sequence is the sum of the previous two
numbers in the sequence. The sequence looks like this: 1, 1, 2, 3, 5, 8, 13,...)
Lab B (PYTHON)
4. Design a python script that will accept the base and height of a parallelogram and compute the
area while printing it.
5. Design a python script to remove and print every second number from a list of
6. Design a python script to create the multiplication table (from 1 to 20) of a number asked from
the user.
8. Design a python program to check weather a triangle is equilateral, isosceles or scalene. (Note :
An equilateral triangle is a triangle in which all three sides are equal. A scalene triangle is a
triangle that has three unequal sides. An isosceles triangle is a triangle with (at least) two equal
sides)
9. Accept string from the user and display only those characters which are present at an
even index. For example str =’python’ so you should display ‘p’,‘t’,’o’.