Re: [Tutor] Barplot order-arrangement

2018-02-13 Thread nelson jon kane
If I try to teach myself Python through YouTube videos, why would anyone hire 
me over someone who has a 2-year Computer Science degree? And why would anyone 
hire someone who has a 2-year Computer Science degree over someone who has a 
4-year Computer Science degree?


Would I be hired if I showed the employer a project I did in Python that was 
more impressive than projects done by the 2-year and 4-year degree people?


If so, then hypothetically, what type of project would that be?


Thanks,

Nelson Kane


From: Tutor  on behalf of 
Charlotte Hoff Sonne 
Sent: Monday, February 12, 2018 10:47:13 AM
To: tutor@python.org
Subject: [Tutor] Barplot order-arrangement

Hi,

I have created a barplot in Python. Now I want to arrange the order of the bars 
differently. I want them to be ordered from highest to lowest - how do I do 
that? Furthermore, I would like the names of the bars to be vertical - how do I 
do that?

This is the code I have written:
sns.barplot(x='word',y='andelelite',data=plotpanda)

I have also attached a picture of the plot I have created.
[cid:5226C847-252D-4E1A-9657-D4512B5085B9@emea.devoteam.com]
___
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] Barplot order-arrangement

2018-02-13 Thread Charlotte Hoff Sonne
Hi,

I have created a barplot in Python 3.6.3 on my Mac OS. Now I want to arrange 
the order of the bars differently. I want them to be ordered from highest to 
lowest - how do I do that? Furthermore, I would like the names of the bars to 
be vertical - how do I do that?

This is the code I have written (sns stands for seaborn):
sns.barplot(x='word',y='andelelite',data=plotpanda)

You can see a picture of my bar chart through this link: https://ibb.co/mUKVfn
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] [Help] urllib.error.HTTPError: HTTP Error 400: Bad Request

2018-02-13 Thread cm
Dear tutors,

I have written below function to open the profanity check url and then
to check for profanity in some text. When I go to the url
http://www.wdylike.appspot.com/?q= and type in the same text, it works
fine.

I am using Microsoft OS X and Python 3.5.2 Interpreter with Pycharm
Community Edition.

---
import urllib.request

def check_profanity(some_text):
# check text for a curse word
connection =
urllib.request.urlopen("http://www.wdylike.appspot.com/?q="+some_text)
output = connection.read()
print(output)
connection.close()

check_profanity(some_text="I gave it a good shot")
---

Error message:
Traceback (most recent call last):
  File "C:/Users/Administrator/PycharmProjects/Udacity/profanity_check.py",
line 29, in 
check_profanity(some_text="I gave it a good shot")
  File "C:/Users/Administrator/PycharmProjects/Udacity/profanity_check.py",
line 15, in check_profanity
connection =
urllib.request.urlopen("http://www.wdylike.appspot.com/?q="+some_text)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 163, in urlopen
return opener.open(url, data, timeout)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 472, in open
response = meth(req, response)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 582,
in http_response
'http', request, response, code, msg, hdrs)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 510, in error
return self._call_chain(*args)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 444,
in _call_chain
result = func(*args)
  File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 590,
in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

Process finished with exit code 1

---
However when I run the code it just says Bad Request. I tried to read
into the traceback message but it refers not only to my file but the
urllib function itself too and I can't understand.

Please kindly help me guide to debug the code.

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


Re: [Tutor] [Help] urllib.error.HTTPError: HTTP Error 400: Bad Request

2018-02-13 Thread Peter Otten
cm wrote:

> Dear tutors,
> 
> I have written below function to open the profanity check url and then
> to check for profanity in some text. When I go to the url
> http://www.wdylike.appspot.com/?q= and type in the same text, it works
> fine.
> 
> I am using Microsoft OS X and Python 3.5.2 Interpreter with Pycharm
> Community Edition.
> 
> ---
> import urllib.request
> 
> def check_profanity(some_text):
> # check text for a curse word
> connection =
> urllib.request.urlopen("http://www.wdylike.appspot.com/?q="+some_text)
> output = connection.read()
> print(output)
> connection.close()
> 
> check_profanity(some_text="I gave it a good shot")
> ---
> 
> Error message:
> Traceback (most recent call last):
>   File
>   "C:/Users/Administrator/PycharmProjects/Udacity/profanity_check.py",
> line 29, in 
> check_profanity(some_text="I gave it a good shot")
>   File
>   "C:/Users/Administrator/PycharmProjects/Udacity/profanity_check.py",
> line 15, in check_profanity
> connection =
> urllib.request.urlopen("http://www.wdylike.appspot.com/?q="+some_text)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 163, in
>   urlopen
> return opener.open(url, data, timeout)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 472, in
>   open
> response = meth(req, response)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 582,
> in http_response
> 'http', request, response, code, msg, hdrs)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 510, in
>   error
> return self._call_chain(*args)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 444,
> in _call_chain
> result = func(*args)
>   File "C:\Program Files\Anaconda3\lib\urllib\request.py", line 590,
> in http_error_default
> raise HTTPError(req.full_url, code, msg, hdrs, fp)
> urllib.error.HTTPError: HTTP Error 400: Bad Request
> 
> Process finished with exit code 1
> 
> ---
> However when I run the code it just says Bad Request. I tried to read
> into the traceback message but it refers not only to my file but the
> urllib function itself too and I can't understand.

Spaces aren't allowed in the url:

>>> c = rq.urlopen("http://www.wdylike.appspot.com/?q=nice try")
[...]
urllib.error.HTTPError: HTTP Error 400: Bad Request

Once you escape the ' ':

>>> c = rq.urlopen("http://www.wdylike.appspot.com/?q=nice+try";)
>>> c.read()
b'false'

Have a look at the first example at

https://docs.python.org/dev/library/urllib.request.html#urllib-examples

for a more general solution.

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


[Tutor] Pong using python

2018-02-13 Thread terrapin-turtle
Tutor, 

Are you aware/familiar with DeVry University using python to educate
students using a PONG game? 

Thank you, 

Lost in python using pong
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Pong using python

2018-02-13 Thread boB Stepp
Greetings!

On Mon, Feb 12, 2018 at 8:49 PM,   wrote:
> Tutor,
>
> Are you aware/familiar with DeVry University using python to educate
> students using a PONG game?

You should assume that we do not.  But we probably can help you if you
provide a specific, targeted question.  Copy and paste a
self-contained code example that demonstrates the problems you are
having in a plain text email.  Copy and paste any error tracebacks you
received (in their entirety).  Let us know which Python version you
are using and your operating system type/version as well.  Ask good
questions and we will do our best to help (But we won't do your
homework for you!).  But if you instead ask vague questions you are
unlikely to get a helpful response.



Good luck and better thinking!
-- 
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor