Vous êtes sur la page 1sur 2

Software Development Fundamentals 1 - Lab Sheet

Week 5: 27th August – 2nd September


Assignment Type: Practice
Lab A (PYTHON)

Code Submission: Upload your Practice assignment


Upload link for each batch has been provided at the fileserver location
(\\fileserver2\Computer Science & IT\ODD 2019\B.Tech\1st Year\SDF-1\SDF-1 Lab\Code
Submission Links)
File name should be your Enrollment number followed by Lab type with week number + labA /B
Eg. For this Week 5 lab A, file name should be 19103213_practice5A.txt.
For more than one file, upload zip file Eg. 19103213_practice5A.zip

Write and execute the following PYTHON programs:


1. Write a python program to calculate the factorial of a number.

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)

The rules of the game are:

•Rock beats scissors

•Scissors beats paper

•Paper beats rock

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)

Code Submission: Upload your Practice assignment


Upload link for each batch has been provided at the fileserver location
(\\fileserver2\Computer Science & IT\ODD 2019\B.Tech\1st Year\SDF-1\SDF-1 Lab\Code
Submission Links)
File name should be your Enrollment number followed by Lab type with week number + labA /B
Eg. For this Week 5 lab B, file name should be 19103213_practice5B.txt.
For more than one file, upload zip file Eg. 19103213_practice5B.zip

Write and execute the following PYTHON programs:


1. Design a python program for generating a password. (Be creative with how you generate
passwords - strong passwords have a mix of lowercase letters, uppercase letters, numbers, and
symbols. The passwords should be random, generating a new password every time the user
asks for a new password. )

2. Design a python program to count the number 5 in a given list.

3. Design a python program to test whether an entered letter is a vowel or consonant.

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

numbers until the list becomes empty.

6. Design a python script to create the multiplication table (from 1 to 20) of a number asked from
the user.

7. Design a python script to get next day of a given date.

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’.

Vous aimerez peut-être aussi