Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'author:': 0.03; 'else:': 0.03; 'elif': 0.05; 'string.': 0.05; '"""': 0.07; 'debugging': 0.07; 'list?': 0.07; 'variables': 0.07; '")': 0.09; 'exits': 0.09; 'strings.': 0.09; 'variables.': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; '"\\n")': 0.16; '->': 0.16; 'calculator': 0.16; 'docstrings': 0.16; 'does,': 0.16; 'field):': 0.16; 'globals': 0.16; 'itertools': 0.16; 'likely.': 0.16; 'list)': 0.16; 'loops': 0.16; 'mode,': 0.16; 'reasonably': 0.16; 'true:': 0.16; 'using,': 0.16; 'variables,': 0.16; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'input': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'number)': 0.24; 'earlier': 0.24; 'math': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '>': 0.26; 'header :In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'fixed': 0.29; 'wondering': 0.29; '(c)': 0.29; 'field,': 0.30; 'list:': 0.30; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'code': 0.31; 'comments': 0.31; 'that.': 0.31; '"")': 0.31; 'asks': 0.31; 'decimal': 0.31; 'names.': 0.31; 'piece': 0.31; 'quotes': 0.31; 'sep': 0.31; 'figure': 0.32; 'front': 0.32; 'url:python': 0.33; 'style': 0.33; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'there': 0.35; 'really': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'two': 0.37; 'list': 0.37; 'clear': 0.37; 'skip:& 10': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'does': 0.39; 'bad': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'remove': 0.60; 'skip:u 10': 0.60; 'read': 0.60; 'skip:\xc2 10': 0.60; 'most': 0.60; 'break': 0.61; 'new': 0.61; 'numbers': 0.61; 'name:': 0.61; 'skip:n 10': 0.64; 'school': 0.64; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'atm': 0.68; '\xc2\xa0\xc2\xa0': 0.74; 'william': 0.81; 'everything.': 0.84; 'itertools,': 0.84; 'median': 0.84; 'returns.': 0.84; "skip:' 80": 0.84; 'joel': 0.91; 'lazy': 0.91; 'sorry.': 0.91; 'luck': 0.93; 'taught': 0.96; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=t4AGOn+7uHzMPfwRA4wGeHgM4pz0T1fEs34adiIGWjE=; b=uuqg61J/U8Twfnb1hsVGSIaLubTNrG2QIpRNciZKp3h3kcywHYkl9p/IWhZ6WReFa+ YC1DLXYWRyMl828eTEjDmR0mfVrk3a0QRun/YwpAMhPPfDsC/EH+r/6bzuWvjKpU7GC5 qENjsVIqQnCru12LT12g3Rrro+R7iq2JFO67iLeuV6BYRXvZ3a8a6afp7WVMbu21icAd 6G79eEm68qDAquvpr6zk0KfM8ZLaMD0v6bWn+b+sJupzovpJ/5T5xdcr8Zd6Wq5elxbu GqXVjBgI0HSHLgFlrrkCzaeRvomgeeVOzdLpOu3jdeTRWEqdEZ4aFJDZOGDWKY/s1y6e SXpw== MIME-Version: 1.0 X-Received: by 10.220.74.69 with SMTP id t5mr13673222vcj.18.1379451736811; Tue, 17 Sep 2013 14:02:16 -0700 (PDT) In-Reply-To: <1540971c-7868-4f01-be3b-98fd5dffa985@googlegroups.com> References: <571f1251-17a5-44db-a859-17a6d8065151@googlegroups.com> <1540971c-7868-4f01-be3b-98fd5dffa985@googlegroups.com> Date: Tue, 17 Sep 2013 17:02:16 -0400 Subject: Re: How do I calculate a mean with python? From: Joel Goldstick To: William Bryant Content-Type: multipart/alternative; boundary=047d7b624cbec1ed6404e69aa254 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 439 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379451740 news.xs4all.nl 15890 [2001:888:2000:d::a6]:55617 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54331 --047d7b624cbec1ed6404e69aa254 Content-Type: text/plain; charset=UTF-8 On Tue, Sep 17, 2013 at 4:10 PM, William Bryant wrote: > Ok I think I've fixed it thanks I read everything. > > > '''**************************************************************************''' > #* Name: Mode-Median-Mean Calculator > *# > #* > *# > #* Purpose: To calculate the mode, median and mean of a list of > numbers *# > #* and the mode of a list of strings because that is what we > are *# > #* learning in math atm in school :P > *# > #* > *# > #* Author: William Bryant > *# > #* > *# > #* Created: 11/09/2013 > *# > #* > *# > #* Copyright: (c) William 2013 > *# > #* > *# > #* Licence: IDK :3 > *# > > '''**************************************************************************''' > > The above comments are a mess. In python, use docstrings -- put 3 quotes > in front of all the documentation, and 3 at the end like: > """ > Name: Mode-Median-Mean Calculator Purpose: To calculate the mode, median and mean of a list of numbers *# """ There is a utility called pydoc that will pull all docstrings from a module and produce nice documentation. So better to learn this style early #-----# ~~Import things I am using~~ #-----# # | # | # \/ import time import itertools I don't think you use itertools, so remove the reference #-----# ~~Variables that I am using, including the list.~~ #-----# # | # | # \/ List = [] NumberOfXItems = [] Using global variables is a very bad idea. Since you seem to be a novice, I'm wondering where you even learned about global variables. If your instructor taught you, then (s)he should look for a new line of work. Using globals promotes lazy thought, makes debugging impossible in any reasonably large piece of code. Google about that. Its important #-----# ~~Functions that I am using.~~ > #-----# > > # | > # | > # \/ > > Use better names. What does HMNs mean? This function asks the user to input a list of strings or numbers. It is almost identical to HMNn to that point that they should be combined most likely. > def HMNs(): > """ Here you should write about the function -- what it does, what is needs passed to it, and what it returns. """ > 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: > ") > 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) > if List.count == int(user_inputHMNs): > break > print("\n*Mode*:", mode()) > print("*Median*:", "\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: ") > 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) > if List.count == int(user_inputHMNn): > break > print("\n*Mode*:", mode()) > print("*Median*:", "") > print("*Mean*:", mean()) > > def NOS(): > while True: # Loops forever (until the break) > answer = input("Does your list contain a number or a string? > \nEnter: ") > answer = answer.lower() > if answer in ("string", "str", "s"): > HMNs() > break > elif answer in ("number", "num", "n", "int"): > HMNn() > break > elif answer in ("quit", "q"): > break # Exits the while loop > else: > print("You did not enter a valid field, :P Sorry. \nEnter: ") > time.sleep(1.5) > > def mean(): > thesum = sum(List) > amount = len(List) > themean = thesum / amount > return themean > > def mode(): > max_occurrences = 0 > themode = None > for i in List: > thecount = List.count(i) > if thecount > max_occurrences: > max_occurrences = thecount > themode = i > return themode > > > > #-----# ~~The functions which need calling~~ > #-----# > > # | > # | > # \/ > > NOS() > So, I just added a few criticisms earlier above. To sumarize: avoid global variables, document functions with docstrings, use really clear names for variables including function names. If you have code in two functions that is almost identical, figure out how to make them one function good luck > -- > https://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com --047d7b624cbec1ed6404e69aa254 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Tue, Sep 17, 2013 at 4:10 PM, William Bryant &= lt;gogobebe2@gmail= .com> wrote:
Ok I think I've fixed= it thanks I read everything.

'''************************************************************= **************'''
#* Name: =C2=A0 =C2=A0 =C2=A0 =C2=A0Mode-Median-Mean= Calculator =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* Purpose: =C2=A0 =C2=A0 To calculate the mode, median and mean of a list = of numbers =C2=A0 *#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0and the mode of a list o= f strings because that is what we are *#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0learning in math atm in = school :P =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* Author: =C2=A0 =C2=A0 =C2=A0William Bryant =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* Created: =C2=A0 =C2=A0 11/09/2013 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* Copyright: =C2=A0 (c) William 2013 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*#
#* Licence: =C2=A0 =C2=A0 IDK :3 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0*#
'''************************************************************= **************'''

The above comments are a mess.=C2=A0 In python, use= docstrings -- put 3 quotes in front of all the documentation, and 3 at the= end like:
"""
= =C2=A0=C2=A0=C2=A0 Name: =C2=A0 =C2=A0 =C2=A0 =C2=A0Mode-Median-Mean Calcul= ator
=C2=A0=C2=A0=C2=A0 Purpose: =C2=A0 =C2=A0 To calculate the mode, median and= mean of a list of numbers =C2=A0 *#
=C2=A0=C2=A0= =C2=A0 """

There is a utility called pydoc that will = pull all docstrings from a module and produce nice documentation.=C2=A0 So = better to learn this style early

#-----# =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ~~Im= port things I am using~~ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #-----#

# =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
# =C2=A0 =C2=A0 =C2=A0 =C2=A0|
# =C2=A0 =C2=A0 =C2=A0 \/

import time
import itertools

I don't think you use itertools, so remove the = reference

#-----# =C2=A0 =C2=A0 =C2=A0 =C2=A0~~Variables that I am using, including t= he list.~~ =C2=A0 =C2=A0 =C2=A0 =C2=A0#-----#

# =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
# =C2=A0 =C2=A0 =C2=A0 =C2=A0|
# =C2=A0 =C2=A0 =C2=A0 \/

List =3D []
NumberOfXItems =3D []

Using global variables is a very bad idea.=C2= =A0 Since you seem to be a novice, I'm wondering where you even learned= about global variables.=C2=A0 If your instructor taught you, then (s)he sh= ould look for a new line of work.=C2=A0 Using globals promotes lazy thought= , makes debugging impossible in any reasonably large piece of code.=C2=A0 G= oogle about that.=C2=A0 Its important


#-----# =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= ~~Functions that I am using.~~ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #-----#

# =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
# =C2=A0 =C2=A0 =C2=A0 =C2=A0|
# =C2=A0 =C2=A0 =C2=A0 \/

Use better names.=C2=A0 What does HMNs mean?=C2= =A0 This function asks the user to input a list of strings or numbers.=C2= =A0 It is almost identical to HMNn to that point that they should be combin= ed most likely.
=C2=A0
def HMNs():
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 """
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Here you should write about the= function -- what it does, what is needs passed to it, and what it returns.=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 """


=C2=A0
=C2=A0 =C2=A0 global TheStr, user_inputHMNs, List_input, List
=C2=A0 =C2=A0 user_inputHMNs =3D input("You picked string. This progra= m cannot calculate the mean or median, but it can calculate the mode. :D = =C2=A0How many strings are you using in your list? (Can not be a decimal nu= mber) =C2=A0\nEnter: =C2=A0")
=C2=A0 =C2=A0 user_inputHMNs
=C2=A0 =C2=A0 time.sleep(1.5)
=C2=A0 =C2=A0 TheStr =3D int(user_inputHMNs)
=C2=A0 =C2=A0 for i in range(TheStr):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 List_input =3D input("Enter your strings. = (One in each input field): =C2=A0")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 List.append(List_input)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("Your list -> ", List)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if List.count =3D=3D int(user_inputHMNs):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("\n*Mode*:", mode())
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("*Median*:", = =C2=A0"<Coming soon!>\n")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("*Mean*:", =C2=A0 =C2=A0m= ean())

def HMNn():
=C2=A0 =C2=A0 global TheNum, user_inputHMNn, List_input, List
=C2=A0 =C2=A0 user_inputHMNn =3D input("You picked number. :D How many= numbers are you using in your list? (Can not be a decimal number) \nEnter:= =C2=A0")
=C2=A0 =C2=A0 user_inputHMNn
=C2=A0 =C2=A0 time.sleep(1.5)
=C2=A0 =C2=A0 TheNum =3D int(user_inputHMNn)
=C2=A0 =C2=A0 for i in range(TheNum):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 List_input =3D input("Enter your numbers. = (One in each input field): =C2=A0")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 List_input =3D int(List_input)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 List.append(List_input)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("\nYour list -> ", List)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if List.count =3D=3D int(user_inputHMNn):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("\n*Mode*:", mode())
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("*Median*:", = =C2=A0"<Coming soon!>")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("*Mean*:", =C2=A0 =C2=A0m= ean())

def NOS():
=C2=A0 =C2=A0 while True: # Loops forever (until the break)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 answer =3D input("Does your list contain a= number or a string? =C2=A0\nEnter: ")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 answer =3D answer.lower()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if answer in ("string", "str&quo= t;, "s"):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 HMNs()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break
=C2=A0 =C2=A0 =C2=A0 =C2=A0 elif answer in ("number", "num&q= uot;, "n", "int"):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 HMNn()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break
=C2=A0 =C2=A0 =C2=A0 =C2=A0 elif answer in ("quit", "q"= ):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break =C2=A0# Exits the while loo= p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print("You did not enter a v= alid field, :P Sorry. =C2=A0\nEnter: ")
=C2=A0 =C2=A0 time.sleep(1.5)

def mean():
=C2=A0 =C2=A0 thesum =3D sum(List)
=C2=A0 =C2=A0 amount =3D len(List)
=C2=A0 =C2=A0 themean =3D thesum / amount
=C2=A0 =C2=A0 return themean

def mode():
=C2=A0 =C2=A0 max_occurrences =3D 0
=C2=A0 =C2=A0 themode =3D None
=C2=A0 =C2=A0 for i in List:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 thecount =3D List.count(i)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if thecount > max_oc= currences:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 max_occurrences =3D thecount
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 themode =3D i
=C2=A0 =C2=A0 return themode



#-----# =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ~~The functions wh= ich need calling~~ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #-----#=

# =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
# =C2=A0 =C2=A0 =C2=A0 =C2=A0|
# =C2=A0 =C2=A0 =C2=A0 \/

NOS()


So, I just added = a few criticisms earlier above.=C2=A0 To sumarize:
=C2=A0=C2= =A0 avoid global variables, document functions with docstrings, use really = clear names for variables including function=C2=A0 names.=C2=A0 If you have= code in two functions that is almost identical, figure out how to make the= m one function

good luck



--
--047d7b624cbec1ed6404e69aa254--