Sale!

Python, Assignment 1

$30.00

Category:
5/5 - (2 votes)

Python, Assignment 1
A. Reinforcement of concepts / methods
Q1
(a) Write a Python function that takes a positive integer n, and returns the sum of the squares of all
the positive integers smaller than n.
(b) Write a Python function that takes a positive integer n, and returns the sum of the squares of all
the odd positive integers smaller than n.
Q2
What parameter values should be sent to the range constructor to produce a range with values:
(a) 60,70,80
(b) 4,2,0,-2,-4
B. Creativity
Q3
Write a Python function that takes a sequence of integer values and determines if there is a distinct pair of
numbers in the sequence whose product is odd.
Q4
Write a Python function that counts the number of vowels in a given character string.
Q5
Write a Python program that takes as input three integers, “a”, “b” and “c”, from the console and
determines if they can be used in the following arithmetic formulas: (i) “a+b=c”, (ii) “a=b-c”, (iii) “a*b=c”.
C. Project-based / Cross-Contextual
Q6
https://en.wikipedia.org/wiki/Birthday_problem
Design a program that can test the Birthday problem, by a series of experiments, on randomly generated
birthdays which test this paradox for n = 5,10,15,20,25,30…200.

Reviews

There are no reviews yet.

Be the first to review “Python, Assignment 1”

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

Scroll to Top