lundi 16 janvier 2023

How to compare numbers in a python guessing game [closed]

My teachers has given me a challenge to try and create a game in python. The game is to guess a random number, the number being anywhere from 1000-9999. However, he has asked for the code to return what number matches a number in the random number. So if the random is 6392 and user inputs 4291, output that 9 is in the right place and correct but the rest are wrong. The only way I can think of doing this is by comparing an array, but I don't understand how to convert it and compare it. Or I've just confused myself. Any help appreciated!

I've tried to use some sort of functions I found online but they don't seem to work.




Aucun commentaire:

Enregistrer un commentaire