Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.programming > #2914

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

From Marc 'BlackJack' Rintsch <marc@rintsch.de>
Newsgroups alt.comp.programming
Subject Re: Writing a program, that tells the right answer from "Yes" or "No" to any appropriate question.
Date 2021-05-07 23:04 +0000
Organization A noiseless patient Spider
Message-ID <s74h1v$lji$1@dont-email.me> (permalink)
References <3eb9186c-e0f3-41dd-a1b2-98387d0f2430@googlegroups.com>

Show all headers | View raw


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

Back to alt.comp.programming | Previous | NextNext in thread | Find similar


Thread

Re: Writing a program, that tells the right answer from "Yes" or "No" to any appropriate question. Marc 'BlackJack' Rintsch <marc@rintsch.de> - 2021-05-07 23:04 +0000
  Re: Writing a program, that tells the right answer from "Yes" or "No" to any appropriate question. Robam Robam <ya12983@mail.com> - 2021-05-08 03:47 -0700

csiph-web