mercredi 17 juin 2020

How to make "action, based on user input" code look prettier? [duplicate]

For example, if user inputs a, program should print x, if user inputs b, program should print y, if user types c, program should print z. And so on.

Is there a way to make it without if elif elif elif elif elif...? I mean... It doesn't look right to me, there should be a better way to do so. Right?

Aucun commentaire:

Enregistrer un commentaire