Combination of Numbers coderinme

Combination of Numbers coderinme

Combination of Numbers coderinme
Let us now code something based on numbers. Such as, We can create a kind of puzzle by jumbling some of the digits. In other words we can mix and match different digits to create different numbers in the number system.
For example : We are now going to print print all the possible combinations using the three digits – 1, 2, and 3. It is just like the numbers obtained could be 123, 231, 213, 231,132,312, 321.
Print all combination from 1 2 3

#!/usr/bin/env python
for i in range(1,4):
j=i+1
if(j!=i and j<3):
print i,j,j+1
print i,j+1,j
for i in range(2,4):
j=i+1
if(j!=i and j<=3):
print i,j,j-2
print i,j-2,j
for i in range(3,4):
j=i-1
if(j!=i and j>0):
print i,j-1,j
print i,j,j-1

For more programs on Python, visit our Python Coder Archives

combination of numbers

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.