-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession_1_assignment_1_q2q3q4 code.py
More file actions
52 lines (46 loc) · 1.2 KB
/
Copy pathsession_1_assignment_1_q2q3q4 code.py
File metadata and controls
52 lines (46 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
"""
-Session 1
-Assignment ONE
"""
##assignmnet 1 question 2
print("*/ assignment 1 output 2/*")
#defining function for finding elements divisible by 7 but not by 5
def divby7notby5(x,y):
print("values divisible by 7 not by 5 between %d and %d are \n" %(x,y))
for i in range(x,y+1):
if i%7==0:
if i%5!=0:
print(i,end=",")
divby7notby5(2000,3200)
print('\n')
print("-"*100)
"""
-Session 1
-Assignment ONE
"""
#assignmnet 1 question 3
print("*/ assignment 1 output 3/*")
#asking user for inputs
f_name=input("your first name please: ")
l_name=input("your last name please: ")
print("in reverse order:",l_name," ",f_name)
print("-"*100)
print('\n')
"""
-Session 1
-Assignment ONE
"""
#assignmnet 1 question 4
print("*/ assignment 1 output 4/*")
import math
#defining function for caluculation of volume of sphere
def volofsphere(D):
print("diameter of sphere: %d" %D)
Volume=(4/3)*math.pi*(D/2)*(D/2)*(D/2)
return round(Volume,2)
volofsphere(12)
print("Volume of sphere is %f --rounded off to two digits" %(volofsphere(12)))
print("-"*100)
print('\n')
print("End of assignment")