[Tutor] Pip issue
Hi all, I just joined since I'm new to working in python for data management and have been stumped on using pip. My understanding is that it should be in my scripts folder of Windows Python3.6 (downloaded from python.org), but it's not, so it doesn't work to run "pip install ". I see there's get-pip.py, but the documentation on using it is confusing. Thanks for your help. Adam ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 176, Issue 13
Also, try (works for me in Python3) rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' } for key, value in rivers.items(): print (key) for key, value in rivers.items(): print (value) for key, value in rivers.items(): print ("The " + key + " is in the country of " + value) On Thu, Oct 11, 2018 at 12:41 PM Rajnish Sinha < rajnish.si...@infoprolearning.com> wrote: > Try > for river in rivers: > print ("The " + river + " is in the country of " + rivers[river]) > > On Wed, Oct 10, 2018 at 9:30 PM wrote: > > > Send Tutor mailing list submissions to > > tutor@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-requ...@python.org > > > > You can reach the person managing the list at > > tutor-ow...@python.org > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of Tutor digest..." > > Today's Topics: > > > >1. Re: help please (Abdur-Rahmaan Janhangeer) > >2. Re: Advanced python recommendations (Abdur-Rahmaan Janhangeer) > >3. Re: help please (Mirage Web Studio) > >4. Re: help please (Deepak Dixit) > >5. Re: Advanced python recommendations (Mariam Haji) > > > > > > > > -- Forwarded message -- > > From: Abdur-Rahmaan Janhangeer > > To: Michael Schmitt > > Cc: tutor > > Bcc: > > Date: Wed, 10 Oct 2018 11:53:41 +0400 > > Subject: Re: [Tutor] help please > > i think it should have been > > > > for river in rivers instead of > > for rivers in rivers > > > > Abdur-Rahmaan Janhangeer > > https://github.com/Abdur-rahmaanJ > > Mauritius > > > > > > > > > > -- Forwarded message -- > > From: Abdur-Rahmaan Janhangeer > > To: Mariam Haji > > Cc: Tutor@python.org > > Bcc: > > Date: Wed, 10 Oct 2018 14:26:24 +0400 > > Subject: Re: [Tutor] Advanced python recommendations > > apart from already said, see popular python projects, and read the source > > as you would read a book. you'll discover amazing tricks, it'll broaden > > your horizon. hanging around those who achieved a good level will make > you > > level up. > > > > Abdur-Rahmaan Janhangeer > > Mauritius > > > > > > > > > > -- Forwarded message -- > > From: Mirage Web Studio > > To: Michael Schmitt , Python Tutor Mailing > > List > > Cc: > > Bcc: > > Date: Wed, 10 Oct 2018 13:45:40 +0530 > > Subject: Re: [Tutor] help please > > You are using the same variable name twice. > > You may use "rivers" for the dict and "river" for values. > > Also use descriptive names for variables. For eg if you correct the above > > mistake, the next one will be this line > > > > for rivers in rivers.values(): > > print (rivers) > > > > > > and sorry for top positing. > > > > > > On Wed 10 Oct, 2018, 12:38 Michael Schmitt, > > wrote: > > > > > To whom it may concern: > > > > > > > > > I am trying to teach myself Python and ran into a problem. This is my > > code > > > > > > > > > # name of rivers and country > > > > > > rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' } > > > > > > # prints river name > > > for rivers in rivers.keys(): > > > print (rivers) > > > > > > #prints country > > > for rivers in rivers.values(): > > > print (rivers) > > > > > > # prints statement " The (river) is in the country of (country) > > > for rivers in rivers: > > > print ("The " + rivers.keys() + "is in the country of " + > > > rivers.vaules()) > > > > > > I am getting the following error > > > for rivers in rivers.values(): > > > AttributeError: 'str' object has no attribute 'values' > > > > > > Thanks for the help. > > > > > > Sincerely, > > > > > > Michael S. Schmitt > > > > > > > > > [ > > > > > > https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif > > > ]< > > > > > > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon > > > > > > Virus-free. www.avast.com< > > > > > > https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link > > > > > > > ___ > > > Tutor maillist - Tutor@python.org > > > To unsubscribe or change subscription options: > > > https://mail.python.org/mailman/listinfo/tutor > > > > > > > > > > > > > -- Forwarded message -- > > From: Deepak Dixit > > To: Michael Schmitt > > Cc: tutor@python.org > > Bcc: > > Date: Wed, 10 Oct 2018 12:43:46 +0530 > > Subject: Re: [Tutor] help please > > On Wed, Oct 10, 2018, 12:37 PM Michael Schmitt < > mikeschmitt...@outlook.com > > > > > wrote: > > > > > To whom it may concern: > > > > > > > > > I am trying to teach myself Python and ran into a problem. This is my > > code > > > > > > > > > # name of rivers and country > > > > > > rivers = {'nile' : 'egypt', 'oh
Re: [Tutor] Help please
The program works as is in Python3. For Python2, change input to raw_input and see if that makes it work (I know it worked for me when I had Python2). Also, it looks better to use " + " instead of a comma: print("Combining these foods will you," + new_food) Also, colons and spaces are good practices when using input boxes, such as food_1=raw_input("Sushi: ") On Thu, Oct 11, 2018 at 1:23 PM Carlton Banks wrote: > https://www.w3schools.com/python/ref_func_input.asp > > tor. 11. okt. 2018 18.51 skrev Carlton Banks : > > > What are you trying to do? > > > > tor. 11. okt. 2018 18.33 skrev Holly Jo : > > > >> > >> I have no clue what I’m doing wrong, I’m a new student > >> > >> food_1=input("Sushi") > >> food_2=input("Quesdilla") > >> new_food=food_1+food_2 > >> print("Combining these foods will you,",new_food) > >> input("Press enter to continue") > >> > >> > >> Sent from Mail for Windows 10 > >> > >> ___ > >> Tutor maillist - Tutor@python.org > >> To unsubscribe or change subscription options: > >> https://mail.python.org/mailman/listinfo/tutor > >> > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Help
Try this cleaned up version with colons in the right places, dollar signs removed, and other corrections: beefmeals=int(input("Enter number of beef meals: ")) shitmeals=int(input("Enter number of vegan meals: ")) party = beefmeals + shitmeals print("Total meals", party) a = 0 b = 0 c = 0 if party <= 50: a=75 print("Room cost $75") elif party <= 150: b=150 print("Room cost $150") else: c=250 print("Room cost $250") roomtax = party * 0.065 print("Room tx", roomtax) print("Beef Meals", beefmeals) beef = (beefmeals * 15.95) print("Beef cost", beef) print("Vegan Meals", shitmeals) shit = (shitmeals * 10.95) print("Vegan cost", shit) cost=(beef + shit) grat= cost * 0.18 print("Gratuity", grat) GT = print("Grand total", grat + beef + shit + a + b + c) On Fri, Oct 26, 2018 at 7:28 AM Bob Gailer wrote: > On Oct 26, 2018 6:11 AM, "Ben Placella" > wrote: > > > > I need to write code that runs a cost calculating program with many > > different variables and I honestly don't understand it > > Could you be more specific? What exactly don't you understand, or even > better what do you understand? > > my code is: > > How could you have written so much code without understanding it? > > > beefmeals=int(input("Enter number of beef meals: ")) > > shitmeals=int(input("Enter number of vegan meals: ")) > > party=beefmeals+shitmeals > > print(party) > > if party<=50 > > Something is missing from that last statement. Can you tell what it is? Do > you know how to find out? Hint use help. > > Hint 2 it is also missing from the elif and else statements. > > > a=75 > > print("Room cost $75") > > elif party <=150 > > b=150 > > print("Room cost $150") > > else > > c=250 > > print("Room cost $250") > > roomtax=party*0.065 > > print(roomtax) > > print("Beef Meals", beefmeals) > > $beef=(beefmeals*15.95) > > print($beef) > > print("Beef cost", $$beef) > > print("Vegan Meals", shitmeals) > > $shit=(shitmeals*10.95) > > print($shit) > > cost=($beef+$shit) > > grat=cost*0.18) > > print(grat) > > GT=(grat+$beef+$shit+(a,b,c)) > > There is a convention in Python that and all uppercase name is a constant. > This is not a requirement. > > > print(GT) > > > > This is what the output is supposed to be: > > I don't see any output here. Alan''s responses may help you figure that > out. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Help
On Fri, Oct 26, 2018 at 3:03 PM Bob Gailer wrote: > On Oct 26, 2018 1:20 PM, "Adam Eyring" wrote: > > > > Try this cleaned up version with colons in the right places, dollar > signs removed, and other corrections: > > Does it do what you want? > > > beefmeals=int(input("Enter number of beef meals: ")) > > shitmeals=int(input("Enter number of vegan meals: ")) > > party = beefmeals + shitmeals > > print("Total meals", party) > > a = 0 > > b = 0 > > c = 0 > > There is no need for three variables here. You only need one to represent > room cost. If you make that change then you will also not need to > initialize the room cost variable. Makes the code simpler to maintain and > read and understand. > > > if party <= 50: > > > > a=75 > > print("Room cost $75") > > If you use one variable for room cost then you can use just one print just > above the room tax line. > > > elif party <= 150: > > > > b=150 > > print("Room cost $150") > > else: > > c=250 > > print("Room cost $250") > > roomtax = party * 0.065 > > print("Room tx", roomtax) > > print("Beef Meals", beefmeals) > > beef = (beefmeals * 15.95) > > print("Beef cost", beef) > > print("Vegan Meals", shitmeals) > > shit = (shitmeals * 10.95) > > print("Vegan cost", shit) > > cost=(beef + shit) > > grat= cost * 0.18 > > print("Gratuity", grat) > > GT = print("Grand total", grat + beef + shit + a + b + c) > > The print function always returns None. Therefore the effect of this > statement is to assign None to GT. Also note that you don't use GT later on. > You're right - GT is not needed. The print does work with or without "GT =" in Python 3.6.5, though. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Installing python
On Fri, Nov 2, 2018 at 8:10 PM Mark Lawrence wrote: > On 02/11/2018 22:49, Alan Gauld via Tutor wrote: > > On 02/11/2018 21:13, Roger Lea Scherer wrote: > > > >> I have installed python 3.7 on my computer Windows10 > >> (C:\Users\Roger\AppData\Local\Programs\Python\Python37), > > > > Caveat: I'm no expert on modern Windoze. > > But... That looks like the wrong path to me. > > > > My Windows install is usually either in > > > > C:\Python... > > or > > C:\Program files\Python... > > > > Depending on distro... > > > > The C:\Users... path has been the standard for some time for a single > user install. C:\Python was binned some years back for security reasons > whilst C:\Program Files\Python... was added for security reasons. > > The c:\users... path is frustrating to find because the AppData folder by default is hidden. I haven't bothered to make it visible, so I just create a shortcut to the Pythonxx folder to access my code files. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Request for help with code
When I post code with questions, I just copy and paste from Python IDLE 3.6. Colors are removed, but indentation is preserved. On Tue, Nov 6, 2018 at 6:59 PM Mats Wichmann wrote: > On 11/6/18 4:36 PM, Joseph Gulizia wrote: > > Funny using a text editorand showed indented in my browser. > Won't > > bother the list again. > > We don't want you to "not bother" us, just hoping to get things in a > state where we can actually help... > > here's what we end up seeing: > > https://www.mail-archive.com/tutor@python.org/msg79222.html > https://www.mail-archive.com/tutor@python.org/msg79225.html > > since unlike most other languages, indentation is a crucial part of the > syntax, we tend to grumble. > > there must be some solution... guys, do you know of any alternate way to > send a message to the list if a mail client isn't cooperating? or do we > have instructions for beating gmail into submission? Obviously gmail is > a key part of the modern infrastructure despite its (ahem) misfeatures. > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Beginners Book, Python and PyScripter
I haven't gone through many python books, but have been using a copy of Automating the Boring Stuff with Python. It covers lists, dictionaries, scraping data from websites, etc. https://automatetheboringstuff.com/ The PDF is free. Adam On Tue, Dec 4, 2018 at 1:09 PM James Stapleton-Cotton wrote: > Thank you Mats and Steven. I'm back on track now with a different tutorial > which has lead to me to the relevant coding tools. > https://wiki.python.org/moin/BeginnersGuide/NonProgrammers > https://python.swaroopch.com > > On Mon, Dec 3, 2018 at 4:04 PM Mats Wichmann wrote: > > > On 12/3/18 3:35 AM, James Stapleton-Cotton wrote: > > > Hello, > > > > > > On this page ( > > > > > > http://openbookproject.net/thinkcs/python/english3e/way_of_the_program.html > > ) > > > - a book for learning Computer Science using Python - I am directed to > ( > > > http://code.google.com/p/pyscripter) in order to access the > appropriate > > > program development environment, PyScripter. I have downloaded the > latest > > > version of Python from Python.org and PyScripter from a site that I am > > > directed to from the original site mentioned in the beginning of this > > email > > > - (https://sourceforge.net/projects/pyscripter/files/), however I > can't > > > seem to be able to run PyScripter on my Mac. > > > > it looks like from the project's own description that PyScripter is > > intended solely for the Windows environment. > > > > But there are a TON of other IDE products, free and commercial, out > > there, many of which do run on the Mac. > > > > This may be information overload, but try looking here: > > > > https://wiki.python.org/moin/IntegratedDevelopmentEnvironments > > > > > > ___ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > https://mail.python.org/mailman/listinfo/tutor > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Any 'graphical' ways of learning Python
I've liked turtle and make my graphing more interesting by asking for user input such as dimensions, then graph automatically. One starter source for using pygame graphics is https://inventwithpython.com/pygame/ It jumps into game writing very quickly, but provides explanations of commands. The one I'm working on now is using the arcade library developed by a python college professor: http://arcade.academy Many many examples of code (including videos of student projects) are provided to help you write games that resemble many of our favorites. On Wed, Dec 5, 2018, 3:40 AM Alan Gauld via Tutor wrote: > On 05/12/2018 00:39, Matthew Polack wrote: > > > Can anyone recommend any ways of integrating 'graphics' but in a simpler > > way. > > > > Have you considered the turtle module. > > Its limited to drawing shapes but does give some immediate results. > You can of course create functions to draw more sophisticated shapes > etc. And you write the code in an ordinary IDE/editor so its a good > transition from fully graphical scratch to fully text mode Python. > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > On Dec 5, 2018 3:40 AM, "Alan Gauld via Tutor" wrote: On 05/12/2018 00:39, Matthew Polack wrote: > Can anyone recommend any ways of integrating 'graphics' but in a simpler > way. > Have you considered the turtle module. Its limited to drawing shapes but does give some immediate results. You can of course create functions to draw more sophisticated shapes etc. And you write the code in an ordinary IDE/editor so its a good transition from fully graphical scratch to fully text mode Python. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Import CSV
Take a look at the book Automating the Boring Stuff with Python (free PDF): https://automatetheboringstuff.com/ There's a couple of chapters in there for downloading CSV files and extracting the data. On Thu, Dec 13, 2018 at 1:57 PM Sammy Lee wrote: > I need help on how to open a webpage and save the HTML to a given file > path, given a URL. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] graphics library for teaching Python
On Fri, Dec 21, 2018, 3:26 AM Michael Mossey wrote: > > There are two sub-topics I'm interested in - (1) graphics, as in drawing > interesting pictures or art, or using diagrams for data visualization. (2) > Simple games, with the use of sprites. > One that hasn't been mention in yours and Alan's lists is Arcade. Developed in recent years by a Simpson College professor, he's been using it for teaching game development. Supports a lot of features you're asking for and I've been enjoying playing with it. Http://arcade.academy ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor