×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
Assignment of South Point School List in Python South Point - Class XI - Computer Science. Assignment Number 14a
Assignment 2 of South Point School List in Python - Python Language
1663    Arnab De    19/11/2020

Write a program to input an even number N from the user. Next using a loop simultaneously generate all numbers from (N//2-1) to 1 and (N//2+1) to (N-1). After each pair of values is generated, check if the higher value is twice the lower value. If so, then print those pair of values.
For example, if N=24, pair of values generated will be (11,13), (10,14), (9,15), (8,16), (7,17), (6,18), (5,19), (4,20), (3,21), (2,22), (1,23) and for the pair (8,16), condition 2nd number is twice the 1st number is valid. Hence will print (8,16).

School Assignment 2020: South point School

softetechnologies
L=[]
N=int(input("Enter a Even Number"))

for i in range((N//2)-1,0,-1):
    temp=[]
    temp.append(i)
    L.append(temp)
c=0
for j in range((N//2)+1,N):
    L[c].append(j)
    c=c+1

for k in range(0,c):
    if(L[k][0]*2 == L[k][1]):
        print(L[k])

softetechnologies
Assignment of South Point School List in Python South Point - Class XI - Computer Science. Assignment Number 14a
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Rabindranath Tagore
Don't limit a child to your own learning, for he was born in another time.
Rabindranath Tagore
1998
60.42
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     44655
01/01/2018     36856
25/06/2018     36685
28/06/2017     34875
02/08/2017     33472
01/08/2017     27830
06/07/2017     27599
15/05/2017     27166
14/07/2017     22912
11/09/2018     21630
softetechnologies