Re: Writing a program, that tells the right answer from "Yes" or "No" to any appropriate question.

Marc 'BlackJack' Rintsch <[email protected]>
Newsgroups alt.comp.programming
Organization A noiseless patient Spider
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.