Re: Writing a program, that tells the right answer from "Yes" or "No" to any appropriate question.
Robam Robam <[email protected]>
| Newsgroups | alt.comp.programming |
|---|---|
| Message-ID | <[email protected]> |
Has to be 100% right.
Robam
Marc 'BlackJack' Rintsch kirjutas laupäev, 8. mai 2021 kl 02:04:32 UTC+3:
> On Mon, 16 Mar 2020 06:16:55 -0700, Kristjan Robam wrote:
>
> > Is this kind of program already made?
> Yea sure:
>
> ```
> #!/usr/bin/env python3
> import random
>
>
> def main():
> input("Pleas enter a Y/N question: ")
> print("The answer is {}!".format(random.choice(["Yes", "No"])))
>
>
> if __name__ == "__main__":
> main()
> ```
>
> It's not the best, just about right 50% of the time. ;-)
>
> Ciao,
> Marc 'BlackJack' Rintsch
> --
> countSheep
> | sheep |
> sheep := 0.
> [ self isAsleep ] whileFalse: [ sheep := sheep + 1 ].
> ^ sheep