The first task is to generate a random number that has four digits all of which are different.
This project has been partly decomposed for you in that there are three identifiable tasks. - You can however, still spilt them down a bit more.
The second challenge is to make a four digit number where each of the digits are different.
Instead of working with numbers it is easier to work as a string or a data structure such as a list. Remember you can CAST a data type to a string - str(myNumber) will make myNumber into a string.
Working with data structures link
Working with data structures lists
You can test if something is in a list by using in
If thisDigit in myList for example - you can also put a not in front of the in to see if something is not in the list. if thisDigit not in myList