@VishalChoudhary/

Assignment

Python

assignment for data structures lab

fork
loading
Files
  • main.py
main.py
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
print("Build the array...")
myArray = []
print("enter e when you have entered all expected elements in the array.")

while True:
	elem = input("enter the integer you want to add : ")
	if elem == "e":
		break
	else:
		myArray.append(int(elem))

print("your array is : "+ str(myArray))


print("now enter the two elements in whose range you want to avoid addition :")
a = int(input("enter the smaller number : "))
b = int(input("enter the second number : "))

count = 0

for num in myArray :
  if (num < a) or (num > b) :
    count += num
  else :
    count += 0

print("the required sum is : " + str(count) +".")