samedi 20 juin 2020

How do you print numbers with certain conditions?

The question asks 4 digit numbers within a range that has been imputed. The conditions are that there should be no number 4, no multiples of 4, and has to include number 7 at least once.

An example would be:

start: 1069
end : 1074

So far I only have this:

start = int(input("start: ")
end = int(input("end: ")

num_list = [i for i in range(start, end) if i % 4 != 0]

Aucun commentaire:

Enregistrer un commentaire