Re: [Tutor] Welcome to the "Tutor" mailing list

2017-12-18 Thread Juan Mayén
Introduction:
Hi everyone I am Juan and I briefly got into coding early fall but then had
to stop because my Master's program demanded more time. I had started
learning Linux and completing banditoverthewire exercises. Now though I am
interested in at least building one small application, I was thinking of
building a web crawler, or create a bot that will help me place trades in
crypto currency market.

All suggestions and recommendations are welcomed!!

thanks,
Juan M.

On Mon, Dec 18, 2017 at 9:34 AM,  wrote:

> Welcome to the Tutor@python.org mailing list! This list is for folks
> who want to ask (and/or answer) questions from folks who wish to learn
> how to program with Python.  Feel free to ask even the most basic of
> questions -- that's what the list is for!
>
> For best results when asking a question on this list: - Try to write
> some code to solve your problem - Show the code you have written -
> Describe what the code does and what you want it to do - If the code
> generates an error, copy and paste the entire error message, including
> the traceback, into your email. - Tell us what OS and Python version
> you are using.
>
> - Don't ask us to do your homework. - Don't assume we know what you
> are talking about. If you are having trouble with a third-party
> library, include a link to the library home page.
>
> When replying to a posting: - Use Reply All to reply to the entire
> list - Don't top post - put your reply after the text to which you are
> replying
>
> For all posts: - Format your email as plain text, not HTML
>
>
> To post to this list, send your message to:
>
>   tutor@python.org
>
> General information about the mailing list is at:
>
>   https://mail.python.org/mailman/listinfo/tutor
>
> If you ever want to unsubscribe or change your options (eg, switch to
> or from digest mode, change your password, etc.), visit your
> subscription page at:
>
>   https://mail.python.org/mailman/options/tutor/juanmayenjm%40gmail.com
>
>
> You can also make such adjustments via email by sending a message to:
>
>   tutor-requ...@python.org
>
> with the word `help' in the subject or body (don't include the
> quotes), and you will get back a message with instructions.
>
> You must know your password to change your options (including changing
> the password, itself) or to unsubscribe without confirmation.  It is:
>
>   amazing
>
> Normally, Mailman will remind you of your python.org mailing list
> passwords once every month, although you can disable this if you
> prefer.  This reminder will also include instructions on how to
> unsubscribe or change your account options.  There is also a button on
> your options page that will email your current password to you.
>



-- 
University of Central Arkansas '15
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Floating decimal question

2017-12-18 Thread Roger Lea Scherer
This is my first time in this "forum", please be patient I will do my best.

As I was going through a book and came across this challenge, I did what I
believe was a success. And I know there are ways of making the decimal
place be limited to 2 places, but my question is more of understanding why
the following happened.

This is the code I wrote in python:

bill = float(input("What is the price of the bill?: "))
tip15 = bill*1.15
tip20 = bill*1.20

print("Bill plus 15% gratuity is " + str(tip15))
print("Bill plus 20% gratuity is " + str(tip20))



This is the result I got after I ran the code in an IDE (obviously) and
then entered 29.99 in the first line:

What is the price of the bill?: 29.99
Bill plus 15% gratuity is 34.4884995
Bill plus 20% gratuity is 35.988



My question is why does the 15% gratuity go so far beyond the decimal place
when really there should only be 4 places because of multiplication rules,
you know, and I do understand sometimes things work behind the scenes that
you don't see, but on the 20% gratuity it gives the "right" answer? So I
guess I'm just asking why did this happen like this?

Thank you.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Welcome to the "Tutor" mailing list

2017-12-18 Thread Alan Gauld via Tutor
On 18/12/17 15:42, Juan Mayén wrote:
> learning Linux and completing banditoverthewire exercises. Now though I am
> interested in at least building one small application, I was thinking of
> building a web crawler, or create a bot that will help me place trades in
> crypto currency market.
> 
> All suggestions and recommendations are welcomed!!

Popular wisdom suggests that the third party package
"Requests" is superior to the standard library
urllib.request module for web access. You might
like to start with its documentation and examples.

For parsing the HTML returned you can use ElementTree
(etree) or some of the other third party modules.
But etree usually suffices.

Try writing something and if you get stuck send us
the offending code and any error messages(unedited please)
Plus any input/output data.

-- 
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


Re: [Tutor] Floating decimal question

2017-12-18 Thread Alan Gauld via Tutor
On 18/12/17 22:09, Roger Lea Scherer wrote:

> bill = float(input("What is the price of the bill?: "))
> tip15 = bill*1.15
> tip20 = bill*1.20
> 
> print("Bill plus 15% gratuity is " + str(tip15))
> print("Bill plus 20% gratuity is " + str(tip20))
> 
> This is the result

> Bill plus 15% gratuity is 34.4884995
> Bill plus 20% gratuity is 35.988
> 
> My question is why does the 15% gratuity go so far beyond the decimal place
> when really there should only be 4 places because of multiplication rules,

Remember this is binary arithmetic not decimal.
The number of decimal points is not something the
computer sees.

Also, when working with monetary values you should get
into the habit of either using the Decimal module
or converting to pennies, although that still
won't help if multiplying by fractions - you'd
need to convert the percents into full figures too.

Look up floating point accuracy on Wikipedia they
have a good explanation of what you are seeing.

https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems

-- 
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