Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combinations
#1
Here is my code:
#Task 3 Theif#
import itertools
n1 = input("Enter your 1st known number? ")
    

n2 = input("Enter your 2nd known number? ")


n3 = input("Enter your 3rd known number? ")


n4 = input("Enter your 4th known number? ")

numbers = (n1,n2,n3,n4)

verify = ()
while verify != "y" or verify != "n":
  print(n1, n2, n3, n4)
  verify = input(int("Is this correct? (y/n)")
if verify == "y":
    set(list(itertools.permutations([1, 2, 2, 4])))
Task:
Design and write a program that displays all the possible combinations for any four numerical digits entered by the user. The program should avoid displaying the same combination more than once.

PROBLEM:
The code above is what I have got but it keeps giving me errors. Can someone point out where I am wrong and correct it please, I have been stuck on this for several days now.

If I am off track and doing it wrong,can someone send an answer so I can see where I went wrong as I have no clue
Reply


Messages In This Thread
Combinations - by mnnewick - Dec-17-2018, 11:41 AM
RE: Combinations - by ichabod801 - Dec-17-2018, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Get 5 most unique combinations of elements in a 2D list wanttolearn 1 2,317 Sep-24-2020, 02:26 PM
Last Post: buran
  Four digit combinations EHod 4 7,789 Aug-13-2017, 09:14 PM
Last Post: EHod

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020