Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Python programming exercises for all levels of knowledge

Level Description
Level 1 Beginner means someone who has just heard about the Python. He can solve something using very basic classes and/or functions with amount of one or two of them. Answers can be found in Python help or so with least try.
Level 2 Intermediate means someone already learning Python, but also coming from some very good programming background. He can solve something using very basic classes and/or functions with amount of up to three of them. You can’t find answers in Python help or similar places.
Level 3 Advanced. He should use Python on very good professional level knowing many language specific algorithms and certain data structures and functions of it. He really should be able to solve all that tasks using quite demanding techniques from programming point of view really and probably close to expert level on other languages as well.
2. Problem template
#—————————————-#
Question
Hints
Solution
3. Questions
#—————————————-#
Level 1
Question:
Develop a program which will find all special numbers which are divisible by 3 but are not a multiple of 7,
between 3000 and 4200 (both included).
Output should be done like comma-separated sequence and in a single line.
Hints:
Consider use range(#begin, #end) method
Solution:
y=[]
for x in range(3000, 4201):
if (x%3==0) and (x%7!=0):
y.append(str(x))
print ‘,’.join(y)
Level 1
Question:
Construct a program which can calculate the factorial of a given numbers.
Output should be done like comma-separated sequence and in a single line.
Assume the following input is entered to the program:
9
Then, the output should be:
362880
Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
Solution:
def fact(z):
if z == 0:
return 1
return z * fact(z – 1)
z=int(raw_input())
print fact(z)
Level 2
Question:
Invent a program that compile and outputs the value according to the formula below:
D = Square root of [(2 * A * C)/B]
Following are the fixed values of A and B:
A is 50. B is 30.
C variable here values of which should be served as an input to your program in a sequence over coma.
Example
Let us assume the input sequence over coma below is given to the program:
10,15,18
The output of the program should be:
6,7,8
Hints:
If the output received is in decimal form, it should be rounded off to its nearest value (let’s say the output received is 37.0, then it should be printed as 37)
In case of input data being supplied to the question, it should be assumed to be a console input.
Solution:
#!/usr/bin/env python
import math
a=50
b=30
value = []
items=[y for y in raw_input().split(‘,’)]
for c in items:
value.append(str(int(round(math.sqrt(2*a*float(c)/b)))))
print ‘,’.join(value)
Level 2
Question:
Develop a program which takes 2 digits, A,B as input and generates a two-dimensional array. The element value in the i-th row and j-th column of this array should be i*j.
Note: i=0,1.., A-1; j=0,1,¡­B-1.
Example
Assume the following inputs were given to the program:
3,5
The output of the program will be:
[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]]
Hints:
Note: In case of input data being supplied to the question, it should be assumed to be a console input in a comma-separated form.
Solution:
input_str = raw_input()
dimensions=[int(y) for y in input_str.split(‘,’)]
rowNumber=dimensions[0]
colNumber=dimensions[1]
multilist = [[0 for col in range(colNumber)] for row in range(rowNumber)]
for row in range(rowNumber):
for col in range(colNumber):
multilist[row][col]= row*col
print multilist

I wanted to provide here examples for level 3 as well with the solutions but I assume that people should really get going with the first two levels we already listed few examples of exercises to get busy, rest will come later as usual.

Upload your project here

The post Python programming exercises for all levels of knowledge appeared first on High Quality Academic Writing Help and Programming Help.

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"