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


Groups > comp.lang.python > #54332

Re: How do I calculate a mean with python?

Date 2013-09-17 22:26 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: How do I calculate a mean with python?
References <571f1251-17a5-44db-a859-17a6d8065151@googlegroups.com> <1540971c-7868-4f01-be3b-98fd5dffa985@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.90.1379453218.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 17/09/2013 21:10, William Bryant wrote:
> Ok I think I've fixed it thanks I read everything.
>
[snip]
>
> def HMNs():
>      global TheStr, user_inputHMNs, List_input, List
>      user_inputHMNs = input("You picked string. This program cannot calculate the mean or median, but it can calculate the mode. :D  How many strings are you using in your list? (Can not be a decimal number)  \nEnter:  ")

This line doesn't do anything:

>      user_inputHMNs
>      time.sleep(1.5)
>      TheStr = int(user_inputHMNs)
>      for i in range(TheStr):
>          List_input = input("Enter your strings. (One in each input field):  ")
>          List.append(List_input)
>          print("Your list -> ", List)

List.count is a method; it will never equal an integer:

>          if List.count == int(user_inputHMNs):
>              break
>          print("\n*Mode*:", mode())
>          print("*Median*:",  "<Coming soon!>\n")
>          print("*Mean*:",    mean())
>
> def HMNn():
>      global TheNum, user_inputHMNn, List_input, List
>      user_inputHMNn = input("You picked number. :D How many numbers are you using in your list? (Can not be a decimal number) \nEnter:  ")

This line doesn't do anything:

>      user_inputHMNn
>      time.sleep(1.5)
>      TheNum = int(user_inputHMNn)
>      for i in range(TheNum):
>          List_input = input("Enter your numbers. (One in each input field):  ")
>          List_input = int(List_input)
>          List.append(List_input)
>          print("\nYour list -> ", List)

List.count is a method; it will never equal an integer:

>          if List.count == int(user_inputHMNn):
>              break
>          print("\n*Mode*:", mode())
>          print("*Median*:",  "<Coming soon!>")
>          print("*Mean*:",    mean())
>
[snip]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-16 16:33 -0700
  Re: How do I calculate a mean with python? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-17 00:52 +0100
  Re: How do I calculate a mean with python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-16 23:55 +0000
  Re: How do I calculate a mean with python? MRAB <python@mrabarnett.plus.com> - 2013-09-17 01:01 +0100
  Re: How do I calculate a mean with python? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-17 01:08 +0100
  Re: How do I calculate a mean with python? Cameron Simpson <cs@zip.com.au> - 2013-09-17 09:59 +1000
  Re: How do I calculate a mean with python? Dave Angel <davea@davea.name> - 2013-09-17 00:50 +0000
  Re: How do I calculate a mean with python? Travis Griggs <travisgriggs@gmail.com> - 2013-09-17 08:25 -0700
  Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 12:44 -0700
  Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 12:45 -0700
  Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 13:10 -0700
    Re: How do I calculate a mean with python? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-17 17:02 -0400
    Re: How do I calculate a mean with python? MRAB <python@mrabarnett.plus.com> - 2013-09-17 22:26 +0100
      Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 14:31 -0700
        Re: How do I calculate a mean with python? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-17 19:49 -0400
  Re: How do I calculate a mean with python? Bryan Britten <britten.bryan@gmail.com> - 2013-09-17 18:53 -0700

csiph-web