Skip to content

Conversation

gnwankwo
Copy link

@gnwankwo gnwankwo commented Nov 5, 2017

int(x)**2 or pow(int(x),2) will accomplish squaring the odd intergers

int(x)**2 or pow(int(x),2) will accomplish squaring the odd intergers
@Herosoumen
Copy link

Herosoumen commented Apr 8, 2018

n=int(input("Enter any no:"))
l=[x**2 for x in range(1,n+1) if x%2==0]
print(l)
#for even integers

@Herosoumen
Copy link

n=int(input("Enter any no:"))
l=[x**2 for x in range(1,n+1) if x%2!=0]

Copy link
Author

@gnwankwo gnwankwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that definitely fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants