Example HTML page

Workshop – Assignment

There are two Assignments and each assignment contains three questions.

Assignment 1:

Problem 1:

1. Write a python script to read a number from the user and check whether the given number is
a. single digit even or odd number
b. two digit even or odd number
c. three digit even or odd number.
d. for all other cases, it should print “Only 1 or 2 or 3 digit number is allowed”

For example if a user enters a number 45, it should print two digit even number.

Problem 2:

Write a python script to read three sports group of students in a college. The groups include cricket,hockey,tennis. The students are denoted with numbers.

a. Read all the set of students from the user using loop.
b. Print the total number of students in all the groups.
c. Print the student who are in cricket and not in tennis
d. who are playing hockey and tennis.

Note: use sets

Problem 3:

a. Write a python script to read two strings from the user. Find the common letters in both the strings and print the resultant list in sorted order without duplicate elements.  For example “sudhakar” and “sankar” are the two strings the output should be [‘a’,’k’,’s’].

b. Write a python script to read string from the user, print the list of characters in the string without duplicate elements. Print the total length of the resultant list is prime number or not?

Assignment 2:

Problem 1:

Write a python script to read a text file as input.
a. Find the Total number of Vowels in it.
b. Find the Total number of alphabets in it.
c. Find the Total number of white spaces in it.
d. Find the Total number of ‘.’ characters in it.
The text file can be download from the following link.

Input File: motherteresa

Problem 2:

Create a Module name “mystrings” and write the function to encrypt the given string. For example a=1,b=2,c=3…z=26. For example if the string is “azbcd”, the encrypted number for this string is ’36’ (1+26+2+3+4). If any upper characters in the given string then it should convert to lower case first and print the result.

Problem 3:

Write a python script to read a string from the user.

a.print the number times a vowel occurred in the form of dictionary.
b.print the sum of ASCII values of alphabets in a given string.

For example if the string is “sudha123”, filter the numbers from the string and find the ASCII value of ‘s’,’u’,’d’,’h’,’a’ then sum these values. use map, filter and reduce functions.
Note: you can use ord() function to find the ASCII value for a given character. Ex: ord(‘a’)

=======All The Best=======

You can submit the assignment from the following link. please write the program and description and screenshot of the output in a word or pdf file and upload it.

Submit Assignment

Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest