[Tutor] I'm new here, just saying hi

2013-12-12 Thread Derek Jenkins
My recent inclusion into this mailing-list behooves me to give a greeting.
In that vein, hi to all!

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


Re: [Tutor] Simple guessing game - need help with the math

2014-08-15 Thread Derek Jenkins
I am a newbie (please correct me if I am wrong), but I happen to think
that it would be best to suggest that your input be in the same case
as that of your variables. In other words, it appears that you are
suggesting the user make an input choice of H, L, or C while the
program appears to want to handle the variables h, l, or c.

Clearly my statements do not directly relate to math, but I do not see
how your program would be able to handle the input of H, L, or C.

On Fri, Aug 15, 2014 at 12:49 PM, Derek Jenkins  wrote:
> I am a newbie (please correct me if I am wrong), but I happen to think
> that it would be best to suggest that your input be in the same case
> as that of your variables. In other words, it appears that you are
> suggesting the user make an input choice of H, L, or C while the
> program appears to want to handle the variables h, l, or c.
>
> Clearly my statements do not directly relate to math, but I do not see
> how your program would be able to handle the input of H, L, or C.
>
> On Fri, Aug 15, 2014 at 3:37 AM, Sibylle Koczian  
> wrote:
>> Am 13.08.2014 01:25, schrieb Greg Markham:
>>>
>>> while answer == "h" or "l" or "c":
>>>  print ("My guess is: ", guess, "\n")
>>>  answer = input("Is it (H)igher? (L)ower? Or am I (C)orrect? ")
>>>  answer = answer.lower()
>>>  if answer == "h":
>>>  guess = round(int(guess + (change/2)))
>>>  change = change/2
>>>  tries += 1
>>>  elif answer == "l":
>>>  guess = round(int(guess - (guess/2)))
>>>  tries += 1
>>>  elif answer == "c":
>>>  print ("/n/nYay!  I win.  Shall we play again?\n\n")
>>>  os.system('cls' if os.name <http://os.name> == 'nt' else 'clear')
>>>
>>>  else:
>>>  print ("Invalid response.  Please try again.\n")
>>>
>>
>> Something else is wrong, besides the math: this is an infinite loop, because
>> (answer == "h" or "l" or "c") always evaluates to True.
>>
>> And with the condition you probably wanted:
>>
>> while answer == "h" or answer == "l" or answer == "c":
>>
>> the loop wouldn't even start because you set answer = "" in the beginning.
>>
>>
>>
>>
>>
>>
>> ___
>> 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] Printing a list count - Help

2014-08-29 Thread Derek Jenkins
Hi everybody,

I have a list that I want to go through and finally print a total
count of particular items. In this case, I want to print the result of
how many A's and B's are in the list.

honor_roll_count = 0
student_grades = ["A", "C", "B", "B", "C", "A", "F", "B", "B", "B", "C", "A"]

for grades in student_grades:
honor_roll_count = honor_roll_count + 1
if grades == "A" or grades == "B":
print honor_roll_count

The above code prints 8 lines, each being an entry for which item in
the list was either A or B. Again, I'm looking for the result to be
the number 8 itself - the total number of instances that A or B occurs
in the list.

I'm sure there are a handful of easy solutions for this, I just
haven't hit the right combo yet and I thought I'd reach out to the
tutor list for a bit of advice.

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


Re: [Tutor] Printing a list count - Help

2014-08-29 Thread Derek Jenkins
honor_roll_count = 0
student_grades = ["A", "C", "B", "B", "C", "A", "F", "B", "B", "B", "C", "A"]

for grades in student_grades:
if grades == "A" or grades == "B":
honor_roll_count = honor_roll_count + 1
print honor_roll_count



That works more to my liking. Thanks a million, Danny and Bob!

On Fri, Aug 29, 2014 at 3:42 PM, boB Stepp  wrote:
> On Fri, Aug 29, 2014 at 2:17 PM, Derek Jenkins  
> wrote:
>> Hi everybody,
>>
>> I have a list that I want to go through and finally print a total
>> count of particular items. In this case, I want to print the result of
>> how many A's and B's are in the list.
>>
>> honor_roll_count = 0
>> student_grades = ["A", "C", "B", "B", "C", "A", "F", "B", "B", "B", "C", "A"]
>>
>> for grades in student_grades:
>> honor_roll_count = honor_roll_count + 1
>> if grades == "A" or grades == "B":
>> print honor_roll_count
>>
>
> Are you sure you have your increment of honor_roll_count where you
> want it? As it is placed you are counting how many grades of any kind
> there are.
>
> --
> boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Printing a list count - Help

2014-08-29 Thread Derek Jenkins
Alex,

Thanks for taking this one step further! I do appreciate it... +1

On Fri, Aug 29, 2014 at 3:48 PM, Alex Kleider  wrote:
> On 2014-08-29 12:17, Derek Jenkins wrote:
>>
>> Hi everybody,
>>
>> I have a list that I want to go through and finally print a total
>> count of particular items. In this case, I want to print the result of
>> how many A's and B's are in the list.
>>
>> honor_roll_count = 0
>> student_grades = ["A", "C", "B", "B", "C", "A", "F", "B", "B", "B", "C",
>> "A"]
>>
>> for grades in student_grades:
>> honor_roll_count = honor_roll_count + 1
>> if grades == "A" or grades == "B":
>> print honor_roll_count
>>
>> The above code prints 8 lines, each being an entry for which item in
>> the list was either A or B. Again, I'm looking for the result to be
>> the number 8 itself - the total number of instances that A or B occurs
>> in the list.
>
>
> Try the following:
> print("Running Python3 script: 'tutor.py'...")
>
>
> student_grades = ["A", "C", "B", "B", "C", "A", "F",
> "B", "B", "B", "C", "A"]
>
> grades = {}
>
> for grade in student_grades:
> grades[grade] = grades.get(grade, 0) + 1
>
> for grade in sorted(grades.keys()):
> print("'{}': {}".format(grade, grades[grade]))
>
> If you are using Python 2, I believe the get method is called something
> else; you can look it up if need be.
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Good Text Editor/IDE for Python

2014-08-31 Thread Derek Jenkins
Juan,

Besides Kwrite, I actually use the tools that the others mentioned so
far, although I don't use Emacs often at all (perhaps I have just not
found an advantageous use for it yet). So no real added info here, but
I will say that I've not personally ran into any problems with
Sublime.

For Windows, if you must continue to use it, I can venture to suggest
you give Notepad++ a whirl for a text editor. I have used it on a
handful of occasions and it _generally_ seemed okay enough to keep it
in mind for a rainy day, such as right now. As for PyCharm, I have 0
experience with that so I can't offer any suggestions.



On Sun, Aug 31, 2014 at 9:57 PM, Cameron Simpson  wrote:
> On 01Sep2014 11:13, Steven D'Aprano  wrote:
>>
>> On Sun, Aug 31, 2014 at 09:12:24PM -0300, Juan Christian wrote:
>>>
>>> I've been using PyCharm to code in Python but it seems a bit
>>> "overpowered"
>>> for this task, and there are some annoying bugs. I used Sublime Text 2 in
>>> the past, but it seems to be dead now (last update was JUN/2013), so I
>>> don't really know any good options.
>>>
>>> What do you guys use to code?
>
> [...]
>>
>> You don't say what operating system you're using. I use Linux, and as
>> far as I am concerned, the best IDE for Linux is Linux itself: [...]
>>
>> http://blog.sanctum.geek.nz/series/unix-as-ide/
>>
>> http://michaelochurch.wordpress.com/2013/01/09/ide-culture-vs-unix-philosophy/
>
>
> I'm mostly on OSX, but of course that is a UNIX platform as well:-) So my
> IDE is somewhat like Steven's. BTW, there are many many discussions in the
> python-list archives on the various development environments people use.
>
>
>> My IDE is:
>>
>> - A good programmer's editor, ideally one that supports a tabbed
>>  interface. I normally use kate (from KDE 3, not KDE 4) or geany, or
>>  at a pinch kwrite although it's not tabbed.
>
>
> I'm a vim user, and use it for everything (email, programming, any other
> plain text editing). I've been using vi since, um, maybe 1985, and my
> fingers know it. Of course, I use emacs editing keystrokes (a very limited
> subset of it, anyway) in interactive shells, including the Python
> interactive prompt; it is better in that scenario for me because it is
> modeless - vi is modal, which I find a win for coding.
>
> I don't use tabs or subwindows/panes in the editor. I do use tabs in the
> terminal (and my editor runs in a pane in my terminal).
>
>
>> - A web browser, for looking up documentation and doing web searches.
>
>
> Me too. And I find it very useful to have local copies of the Python doco on
> my desktop; accessing a local copy is really fast and also works when
> offline. I keep a local copy of the latest Python 2 and Python 3 doco to
> hand. This does rely on the doco having a good page size choice; I like a
> "page" to be a chapter. The Python doco does this well, a "page" per module.
> By contrast, the PostgreSQL doco is extremely finely sliced and very
> irritating to browse.
>
> I use tabs heavily in the web browser.
>
>
>> - A good tabbed terminal application. Konsole from KDE is my
>>  preferred choice, but just about any one will do.
>
>
> On OSX the winning choice is iTerm2; I use it exclusively. Tabs and also
> subpanes. It has many good features.
>
>
>> In the terminal, I'll open anything up to half a dozen tabs. One for
>> running source control (git or hg) and other utilities, another for
>> running the application I'm writing and performing tests, and at least
>> one interactive Python session for trying out small snippets and looking
>> up interactive help.
>
>
> I use a tab per dev environment. (So a tab for my main project, and I use
> another tab for whichever of its branches I'm working in.)
>
> Within each tab I usually split the tab into 3 vertical panes: an editor in
> the middle )terminal running vim, for me) and a shell on either side. I open
> python interactive prompts at need as opposed to Steven's always-open
> instance. On occasions I split the vertical panes horizontally when I need
> an extra terminal for something short term.
>
>
>> Just recently, I've customised my interactive Python with a powerful set
>> of tab completion commands, similar to that provided by IPython. While
>> typing, if I hit tab, it will try to complete the current variable,
>> function, module or file name. I don't know how I programmed without it
>> all these years :-)
>
>
> I must try that sometime.
>
> Cheers,
> Cameron Simpson 
>
> Baldrick: Sir, what shall we do if we stand on a mine?
> Edmund: Well, Baldrick - I think the common practice is to jump several
> metres
> into the air, and scatter yourself in a wide radius on the way down.
> - _Blackadder_
>
> ___
> 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