[Tutor] Tutor Digest, Vol 161, Issue 33

Borisco Bizaro boriscobizaro8 at gmail.com
Sun Jul 30 18:36:07 EDT 2017


Please I have been ask to write python code that ask user to enter a price
continuetly until key press to and give the total amount of price I have
enter using while loop I don't know how to go about it,please help me
This is what I have done,
untitled
a=1
b=2
while a<b:
  input ("enter another price :")
print"\n\n press 0 key to stop"
On Jul 24, 2017 01:06, <tutor-request at python.org> wrote:

> Send Tutor mailing list submissions to
>         tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>         tutor-request at python.org
>
> You can reach the person managing the list at
>         tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
> Today's Topics:
>
>    1. Fwd: Re:  Python Help (Alan Gauld)
>    2. Fwd: Re:  Python Help (Alan Gauld)
>    3. Python3 Help (Brandon Anderson)
>    4. class newbie (Michael C)
>
>
> ---------- Forwarded message ----------
> From: Alan Gauld <alan.gauld at yahoo.co.uk>
> To: tutor <tutor at python.org>
> Cc:
> Bcc:
> Date: Sun, 23 Jul 2017 21:45:45 +0100
> Subject: [Tutor] Fwd: Re: Python Help
>
> Forwarding to list,
> please use ReplyAll or ReplyList when responding to the list.
>
>
> -------- Forwarded Message --------
>
> I also tried the correct command for the mac ox s in terminal shell,
> running:
>
> Jims-MacBook-Pro-2:~ Jim$
> PYTHONPATH="/Users/Jim/Documents/illustris_python:$PYTHONPATH
>
> > export PYTHONPATH
>
>
> no error messages there but it is still not finding the module through
> python.
>
> Winonah
>
>
> On Sun, Jul 23, 2017 at 1:34 PM, Winonah Ojanen <winonah1992 at gmail.com
> <mailto:winonah1992 at gmail.com>> wrote:
>
>     I did use the pip command and am attempting to add the files to my
>     python path. I used
>      import sys
>     sys.path.append("/Users/Jim/Documents/illustris_python")
>
>     and that worked. I even checked to make sure the files were there
>
>
>     import sys
>     print (sys.path)
>
>     ['', '/Users/Jim/anaconda/lib/python36.zip',
>     '/Users/Jim/anaconda/lib/python3.6',
>     '/Users/Jim/anaconda/lib/python3.6/lib-dynload',
>     '/Users/Jim/anaconda/lib/python3.6/site-packages',
>     '/Users/Jim/anaconda/lib/python3.6/site-packages/
> Sphinx-1.5.6-py3.6.egg',
>     '/Users/Jim/anaconda/lib/python3.6/site-packages/aeosa',
>     '/Users/Jim/anaconda/lib/python3.6/site-packages/
> setuptools-27.2.0-py3.6.egg',
>     '/Users/Jim/anaconda/lib/python3.6/site-packages/IPython/extensions',
>     '/Users/Jim/.ipython', 'Users/Jim/Documents/illustris_python']
>
>     the file is clearly there but when i try to do import
>     illustris_python as il it still can't find the module.
>
>
> Note that only shows the folder is in the path.
>
> What does an 'ls' listing reveal as to the contents of the folder?
> Is there a file called illustris_python.py? or maybe illustris_python.pyc?
>
>
>
>     I also figured that I need to manually export to python path so i
> tried:
>     export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_python/
>       File "<ipython-input-14-30d153a77da5>", line 1
>         export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_
> python/
>                         ^
>     SyntaxError: invalid syntax
>
>     I got invalid syntax... using a mac os x
>
>     I tried typing in terminal open .bash_profile and telling it to
>     export the python path in there like some others recommended but in
>     terminal it is giving me an error message for that... it must not be
>     the right command for the shell.
>
>     Winonah
>
>     On Sat, Jul 22, 2017 at 9:34 PM, Cameron Simpson <cs at zip.com.au
>     <mailto:cs at zip.com.au>> wrote:
>
>         On 23Jul2017 00:20, Alan Gauld <alan.gauld at yahoo.co.uk
>         <mailto:alan.gauld at yahoo.co.uk>> wrote:
>
>             On 22/07/17 19:14, Winonah Ojanen wrote:
>
>                 using python with anaconda in jupiter notebook. However,
>                 I am having
>
>
>             Usual caveat: The tutor list is targeted at the standard
> library
>             so any help for non standard library modules is best sought
> from
>             the library support fora. In this case that includes the
>             SciPy forum
>             and any illustris one.
>
>
>         Though arguably the OP's problem is an import issue, not really
>         module specific.
>
>             That having been said, I'll take a guess...
>
>                 $ mkdir Illustris-3
>                 $ mkdir Illustris-3/groups_135
>
>             Are these folders in your PYTHONPATH? If not Python will not
>             find them.
>
>                 import illustris_python as il
>                 ------------------------------
> ---------------------------------------------
>                 ModuleNotFoundError                       Traceback
>                 (most recent call last)
>
>
>         The OP cded into the new dir; I'd normally expect things to be
>         found if the module was a local file/dir. However...
>
>                 For some reason the computer is not recognizing this as
>                 a file on my
>                 computer. The CCA folks says this is a coding problem
>                 and not an illustris
>                 problem. any ideas to get me past this? I may also need
>                 help getting
>                 farther into the download process.
>
>
>         I just ran the OP's download command:
>
>          wget -nd -nc -nv -e robots=off -l 1 -r -A hdf5
>         --content-disposition --header="API-Key:
>         d522db2e1b33e36d3b365cc9ac1c2c5d"
>         "http://www.illustris-project.org/api/Illustris-3/files/
> groupcat-135/?format=api
>         <http://www.illustris-project.org/api/Illustris-3/files/
> groupcat-135/?format=api>"
>
>         This doesn't seem to download any Python code at all. It does
>         get a couple of HDF files, presumably with data to work with.
>
>         So the issue is initially that the module isn't present
>         anywhere. Looking at the instructions cited
>         <http://www.illustris-project.org/data/docs/scripts/
>         <http://www.illustris-project.org/data/docs/scripts/>>, they
>         only cover fetching som data and working; they presume the
>         software is already present. I don't immediately see actual
>         software installation instructions, and it is not presented in
> PyPI.
>
>         Most like the OP will have to install the software directly from:
>
>          https://bitbucket.org/illustris/illustris_python
>         <https://bitbucket.org/illustris/illustris_python>
>
>         This command:
>
>          hg clone
>         https://bitbucket.org/illustris/stris_pythonillustris_python
>         <https://bitbucket.org/illustris/stris_pythonillustris_python>
>
>         should produce an "illustris_python" in the current directory,
>         and then her import command will find it.
>
>         However, there are other prerequisites. This pip command:
>
>          pip install h5py numpy
>
>         seems to resolve them. The OP will need to use Python 2 because
>         the module seems to rely on a relative import (for its "util.py"
>         file).
>
>         Cheers,
>         Cameron Simpson <cs at zip.com.au <mailto:cs at zip.com.au>>
>
>         _______________________________________________
>         Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
>         To unsubscribe or change subscription options:
>         https://mail.python.org/mailman/listinfo/tutor
>         <https://mail.python.org/mailman/listinfo/tutor>
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Alan Gauld <alan.gauld at yahoo.co.uk>
> To: tutor <tutor at python.org>
> Cc:
> Bcc:
> Date: Sun, 23 Jul 2017 21:42:26 +0100
> Subject: [Tutor] Fwd: Re: Python Help
> Forwarding to list
>
>
>
> -------- Forwarded Message --------
>
> I did use the pip command and am attempting to add the files to my
> python path. I used
>  import sys
> sys.path.append("/Users/Jim/Documents/illustris_python")
>
> and that worked. I even checked to make sure the files were there
>
>
> import sys
> print (sys.path)
>
> ['', '/Users/Jim/anaconda/lib/python36.zip',
> '/Users/Jim/anaconda/lib/python3.6',
> '/Users/Jim/anaconda/lib/python3.6/lib-dynload',
> '/Users/Jim/anaconda/lib/python3.6/site-packages',
> '/Users/Jim/anaconda/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg',
> '/Users/Jim/anaconda/lib/python3.6/site-packages/aeosa',
> '/Users/Jim/anaconda/lib/python3.6/site-packages/
> setuptools-27.2.0-py3.6.egg',
> '/Users/Jim/anaconda/lib/python3.6/site-packages/IPython/extensions',
> '/Users/Jim/.ipython', 'Users/Jim/Documents/illustris_python']
>
> the file is clearly there but when i try to do import illustris_python
> as il it still can't find the module.
>
> I also figured that I need to manually export to python path so i tried:
> export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_python/
>   File "<ipython-input-14-30d153a77da5>", line 1
>     export PYTHONPATH=$PYTHONPATH:/Users/Jim/Documents/illustris_python/
>                     ^
> SyntaxError: invalid syntax
>
> I got invalid syntax... using a mac os x
>
> I tried typing in terminal open .bash_profile and telling it to export
> the python path in there like some others recommended but in terminal it
> is giving me an error message for that... it must not be the right
> command for the shell.
>
> Winonah
>
> On Sat, Jul 22, 2017 at 9:34 PM, Cameron Simpson <cs at zip.com.au
> <mailto:cs at zip.com.au>> wrote:
>
>     On 23Jul2017 00:20, Alan Gauld <alan.gauld at yahoo.co.uk
>     <mailto:alan.gauld at yahoo.co.uk>> wrote:
>
>         On 22/07/17 19:14, Winonah Ojanen wrote:
>
>             using python with anaconda in jupiter notebook. However, I
>             am having
>
>
>         Usual caveat: The tutor list is targeted at the standard library
>         so any help for non standard library modules is best sought from
>         the library support fora. In this case that includes the SciPy
> forum
>         and any illustris one.
>
>
>     Though arguably the OP's problem is an import issue, not really
>     module specific.
>
>         That having been said, I'll take a guess...
>
>             $ mkdir Illustris-3
>             $ mkdir Illustris-3/groups_135
>
>         Are these folders in your PYTHONPATH? If not Python will not
>         find them.
>
>             import illustris_python as il
>             ------------------------------------------------------------
> ---------------
>             ModuleNotFoundError                       Traceback (most
>             recent call last)
>
>
>     The OP cded into the new dir; I'd normally expect things to be found
>     if the module was a local file/dir. However...
>
>             For some reason the computer is not recognizing this as a
>             file on my
>             computer. The CCA folks says this is a coding problem and
>             not an illustris
>             problem. any ideas to get me past this? I may also need help
>             getting
>             farther into the download process.
>
>
>     I just ran the OP's download command:
>
>      wget -nd -nc -nv -e robots=off -l 1 -r -A hdf5
>     --content-disposition --header="API-Key:
>     d522db2e1b33e36d3b365cc9ac1c2c5d"
>     "http://www.illustris-project.org/api/Illustris-3/files/
> groupcat-135/?format=api
>     <http://www.illustris-project.org/api/Illustris-3/files/
> groupcat-135/?format=api>"
>
>     This doesn't seem to download any Python code at all. It does get a
>     couple of HDF files, presumably with data to work with.
>
>     So the issue is initially that the module isn't present anywhere.
>     Looking at the instructions cited
>     <http://www.illustris-project.org/data/docs/scripts/
>     <http://www.illustris-project.org/data/docs/scripts/>>, they only
>     cover fetching som data and working; they presume the software is
>     already present. I don't immediately see actual software
>     installation instructions, and it is not presented in PyPI.
>
>     Most like the OP will have to install the software directly from:
>
>      https://bitbucket.org/illustris/illustris_python
>     <https://bitbucket.org/illustris/illustris_python>
>
>     This command:
>
>      hg clone
>     https://bitbucket.org/illustris/stris_pythonillustris_python
>     <https://bitbucket.org/illustris/stris_pythonillustris_python>
>
>     should produce an "illustris_python" in the current directory, and
>     then her import command will find it.
>
>     However, there are other prerequisites. This pip command:
>
>      pip install h5py numpy
>
>     seems to resolve them. The OP will need to use Python 2 because the
>     module seems to rely on a relative import (for its "util.py" file).
>
>     Cheers,
>     Cameron Simpson <cs at zip.com.au <mailto:cs at zip.com.au>>
>
>     _______________________________________________
>     Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
>     To unsubscribe or change subscription options:
>     https://mail.python.org/mailman/listinfo/tutor
>     <https://mail.python.org/mailman/listinfo/tutor>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Brandon Anderson <brandonanderson at me.com>
> To: tutor at python.org
> Cc:
> Bcc:
> Date: Sun, 23 Jul 2017 16:19:41 -0700
> Subject: [Tutor] Python3 Help
> Hello!
>
> 1.      I have Python3 installed on my 2017 MacBook Pro. I know that it is
> successfully installed because, when I enter “Python3’ into my terminal,
>         I get the following message:
>
>         Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)
>         [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>         Type "help", "copyright", "credits" or "license" for more
> information.
>
> 2.  I’m trying to locate the directory path to where Python3 is located on
> my system, but when I enter
>         the following command:
>         $ type -a python3
>
>         I get:
>         -bash: $: command not found
>
>         My understanding is that the command should have provided me with
> the path to Python3 is located on my system.
>
> 3.  How do I determine why I’m getting the ‘error’ command, instead of the
> directory location of Python3.
>     I need the location in order to setup my Text Editor to execute
> Python3 commands.
>
> Thank you in advance.
>
> Brandon Anderson
> (510) 468-0154
> brandonanderson at icloud.com
>
>
> ---------- Forwarded message ----------
> From: Michael C <mysecretrobotfactory at gmail.com>
> To: python tutor <tutor at python.org>
> Cc:
> Bcc:
> Date: Sun, 23 Jul 2017 13:24:49 -0700
> Subject: [Tutor] class newbie
> class mahschool:
>     def print():
>         print('Say something')
>
>
> a = mahschool()
>
> a.print()
>
>
>
> With this, I get this error:
>
> Traceback (most recent call last):
>   File "test.py", line 8, in <module>
>     a.print()
> TypeError: print() takes 0 positional arguments but 1 was given
>
>
> What did I do wrong?
>
> Thanks!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> https://mail.python.org/mailman/listinfo/tutor
>
>


More information about the Tutor mailing list