S. D.
COLLEGE OF ENGINEERING & TECHNOLOGY, MUZAFFARNAGAR
(College code 083)
DEPARTMENT OF CSE/IT
Python
SEMESTER:- IV BRANCH:-CS/IT Code:BCC402
ASSIGNMENT-1
Q1.Write a Python program to calculate sum of prime numbers from m to n.
Q2.Write a Python program to convert temperature from Celsius to Fahrenheit
Q3.Write a Python program to check if a given string is a palindrome or not.
ASSIGNMENT-2
Q1 We want make a package of goal kilos of chocolate. We have small bars (1 kilo each) and big bars (5
kilos each). Return the number of small bars to use, assuming we always use big bars before small bars.
Return -1 if it can't be done.
make_chocolate(4, 1, 9) → 4
make_chocolate(4, 1, 10) → -1
make_chocolate(4, 1, 7) → 2
Q2 Given 3 int values, a b c, return their sum. However, if any of the values is a teen -- in the range
13..19 inclusive -- then that value counts as 0, except 15 and 16 do not count as a teens. Write a separate
helper "def fix_teen(n):"that takes in an int value and returns that value fixed for the teen rule. In this
way, you avoid repeating the teen code 3 times (i.e. "decomposition"). Define the helper below and at the
same indent level as the main no_teen_sum().
no_teen_sum(1, 2, 3) → 6
no_teen_sum(2, 13, 1) → 3
no_teen_sum(2, 1, 14) → 3
Q3 Given 2 strings, a and b, return the number of the positions where they contain the same length 2
substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the
same place in both strings.
string_match('xxcaazz', 'xxbaaz') → 3
string_match('abc', 'abc') → 2
string_match('abc', 'axc') → 0
ASSIGNMENT-3
Q1.Write a Python program to count the number of vowels in a string.
Q2.Write a Python program to find the largest and smallest elements in a list.
Q3 To write a python program to compute the GCD of two numbers.
ASSIGNMENT-4
Q1 To write a python program Insertion sort.
Q2 To write a python program selection sort.
Q3 To write a python program first n prime numbers.
ASSIGNMENT-5
Q1 Write python code for enquiry page and implement GUI application.
Q2 To write a python program simulate bouncing ball in Pygame.
Q3 To write a python program find the maximum of a list of numbers.
CONCERNED FACULTY: VIKUL KUMAR