P file
P file
ON
PYTHON PROGRAMMING
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
Script Mode
Output
Program 2.(a) Write a program to compute distance between two points taking input from the user
(Pythagorean Theorem)
Output
Program 3.(a) Write a Program for checking whether the given number is a even number or not.
Output
Program 4.(a) Find the sum of all the primes below two million. Adding the previous two terms, each
new term in the Fibonacci sequence is generated. By starting with 1 and 2, the first 10 terms will be: 1,
2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Output
Program 5.(a) Write a program to count the numbers of characters in the string and store them in a
dictionary data structure.
Output
Program 6.(a) Write a program combine_lists that combines these lists into a dictionary.
Output
Program 7.(a) Write a program to print each line of a file in reverse order.
Output
Program 8.(a)a) Write a function ball_collide that takes two balls as parameters and computes if they are
colliding. Your function should return a Boolean representing whether or not the balls are colliding. Hint:
Represent a ball on a plane as a tuple of (x, y, r), r being the radiusIf (distance between two balls
centers) <= (sum of their radii), then (they are colliding).
colliding)
Output
Program 9.(a) Write a function
ction nearly_equal to test whether two strings are nearly equal. Two strings a
and bare nearly equal when a single mutation on b can generate a.
Output
Program 10.(a) Write a function cumulative_product to compute the cumulative product of a list of
numbers.
Output
Program 11.(a) Install packages requests, flask and explore them using (pip).
Output