Answer:
In Python:
low = int(input("Low: "))
high = int(input("High: "))
if low >= 1000000000 or high >=1000000000:
print("Out of range")
else:
mylist = []
for num in range(low,high+1):
flag = False
if num > 1:
for i in range(2, num):
if (num % i) == 0:
flag = True
break
if not flag:
mylist.append(num)
print(num, end = " ")
print()
print("The twin primes are: ",end="")
count = 0
for i in range(1,len(mylist)):
if mylist[i] - mylist[i-1] == 2:
print(str(mylist[i])+" & "+str(mylist[i-1]),end=", ")
count+=1
print()
print("There are "+str(count)+" twin primes")
Explanation:
See attachment for complete program where comments were used to explain each line