I've been researching python's sorting algorithm, Timsort, and know that
it's a hybrid between insertion sort (best case time complexity O(n)) and
merge sort (O(n log(n))), and has an overall time complexity of O(n
log(n)). What I'm trying to figure out is, when the list is very short,
let's say 2
Hello, I need help running a script, as I am getting an error. Is it possible
if I could get help with it? Please reply if so.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
I never got a response. Should I check my spam?
Sent from my iPhone
On Apr 28, 2014, at 1:57 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 26/04/2014 23:53, jordan smallwood wrote:
Hello,
I am new to Python. I mean completely new and we're working on this
problem set in class
Hey there,
I have this code below (in to cm conversion) and I want to have the user try
again if they enter in a non integer. What am I missing:
ConversionConstant = 2.54
def CalculateCentimeters(inches):
return ConversionConstant * inches
def CalculateInches(centimeters):
return
Hello,
I am new to Python. I mean completely new and we're working on this problem set
in class where they give us specs and we have to build something based off
these specs. I have no idea what they're asking. Could someone help get me
started on the path to figuring this out?
Below is the
Hello,
I am new to Python. I mean completely new and we're working on this problem set
where they give us specs and we have to build something based off these specs.
I have no idea what they're asking. Could someone help get me started on the
path to figuring this out?
Below is the question:
SNIP
Speaking of brain dead, I was taking a break from Python by looking at
a video on finite state machines and the very first example was tennis
scoring. I think the $#@! insane tennis scoring was harder to
understand than the subject.
That got me laughing pretty good, since I too was
On 04/18/2013 02:16 AM, Chuck Mayers wrote:
Hi! I was having a bit of nostalgia today, and thought I'd try to
write a simple, old school BBS. I found the 'paramiko' library, and
I've got something I can SSH into that would have impressed my 1990's
self.
I found some example code of the
Thank you all for the feedback and suggestions. I have never used an
assertion, before so I will read up on the concept. But this last email
about the optimizations makes me want to go with an AssertionError
exception, since assert is skipped if the compiler is told to optimize.
Alan you are
I want to know what exception should be raised if there is a bug in my
code that allows an else statement to be triggered, because the else
condition in my code should be impossible, unless there is an error in
my code. What exception should I raise so that if my code is wrong it
will raise
On 08/22/2012 06:51 PM, Don Jennings wrote:
[slightly OT]
After watching Bret Victor's talk[1], I want **much** better tools for
programming (and all of the other stuff I do on the computer).
John Resig, creator of jQuery, claims[2] that Victor's presentation inspired
the new platform for
On 07/19/2012 12:15 AM, Prasad, Ramit wrote:
SNIP
I think your basic problem is too much conversion because you do not
understand the types. A string is represented by a series of bytes
which are binary numbers. Do you understand the concept behind ASCII?
Each letter has a numeric
On 07/19/2012 08:14 AM, Mark Lawrence wrote:
On 19/07/2012 06:41, wolfrage8...@gmail.com wrote:
On Thu, Jul 19, 2012 at 12:16 AM, Dave Angel d...@davea.name wrote:
SNIP
Really? Are you using a forked version of Python that doesn't need
indentation after a while loop, or are you speaking
Thunderbird
edited the email on me, even though I had put it into plain text mode.
Next time perhaps I will just attach the file if that is acceptable
rather than getting attacked for what my mail editor did.
Regards
Walter
-- Forwarded message --
From: Jordan wolfrage8
On 07/19/2012 12:46 PM, Dave Angel wrote:
On 07/19/2012 01:41 AM, wolfrage8...@gmail.com wrote:
On Thu, Jul 19, 2012 at 12:16 AM, Dave Angel d...@davea.name wrote:
SNIP
That was just the first line that was not indented. If I thought you
had a one-line while loop, I certainly would have
it in a way that makes sense.
On Wed, 18 Jul 2012, Jordan wrote:
OK so I have been trying for a couple days now and I am throwing in the
towel, Python 3 wins this one.
I want to convert a string to binary and back again like in this
question: Stack Overflow: Convert Binary to ASCII and vice versa
A question I have for the group before I respond is a option that I saw
that I had earlier was to ord() each element of a string and then bin()
that number. But since bin() produces a string I could not figure out
the correct way to attach two bin() outputs back together again due to
the leading
On 07/19/2012 08:53 PM, Prasad, Ramit wrote:
I think your basic problem is too much conversion because you do not
understand the types. A string is represented by a series of bytes
which are binary numbers. Do you understand the concept behind ASCII?
Each letter has a numeric representation
On 07/19/2012 09:23 PM, Prasad, Ramit wrote:
A question I have for the group before I respond is a option that I saw
that I had earlier was to ord() each element of a string and then bin()
that number. But since bin() produces a string I could not figure out
the correct way to attach two
On 07/19/2012 09:53 PM, Dave Angel wrote:
On 07/19/2012 03:19 PM, Jordan wrote:
SNIP
OK. I am using one time pads to XOR data, but the one time pads (keys)
are very large numbers, converting them to binary increases their size
exponentially, which allows me to get more XORing done out
On 07/19/2012 10:04 PM, eryksun wrote:
On Thu, Jul 19, 2012 at 3:08 PM, Jordan wolfrage8...@gmail.com wrote:
SNIP
I'm not an expert with cryptography, but here's a simple XOR example:
from itertools import cycle
text = b'Mary had a little lamb.'
key = b'1234'
cypher = bytes(x^y for x,y
Sorry, I am not sure why Thunderbird is stripping the spaces, may have
something to do with a plug-in that I have installed, I will have to
look into it.
On 07/19/2012 10:41 PM, Prasad, Ramit wrote:
Sure, this makes perfect sense to me :) (adding indent)
for char in data:
bin_data +=
On 07/19/2012 10:48 PM, Prasad, Ramit wrote:
SNIP
OK. I am using one time pads to XOR data, but the one time pads (keys)
are very large numbers, converting them to binary increases their size
exponentially, which allows me to get more XORing done out of a single
You want to explain this
OK so I have been trying for a couple days now and I am throwing in the
towel, Python 3 wins this one.
I want to convert a string to binary and back again like in this
question: Stack Overflow: Convert Binary to ASCII and vice versa
(Python)
I would just like to add that I am a web developer and I left PHP for
Python. I left PHP because it was not as powerful server side (Cron Jobs
and Such) and I wanted to possibly create desktop applications, more
recently Android Apps via SL4A and IPhone Apps via pyjamas. PHP is a
limited language
Hello, first off I am using Python 3.2 on Linux Mint 12 64-bit.
I am confused as to why I can not successfully compare a variable that
was created as an octal to a variable that is converted to an octal in a
if statement yet print yields that they are the same octal value. I
think it is because
On 05/30/2012 06:21 PM, Akeria Timothy wrote:
Hello all,
I am working on learning Python(on my own) and ran into an exercise
that I figured out but I wanted to know if there was a different way
to write the code? I know he wanted a different answer for the body
because we haven't gotten to
Thank you for the detailed answer, now I understand and I understand
that each number format is an integer just with a different base and
cosmetic appearance.
On 06/02/2012 01:51 PM, Steven D'Aprano wrote:
Jordan wrote:
Hello, first off I am using Python 3.2 on Linux Mint 12 64-bit.
I am
#String_Concatenation
On 06/02/2012 04:29 PM, Steven D'Aprano wrote:
Jordan wrote:
#Another version might look like this:
def join_strings2(string_list):
final_string = ''
for string in string_list:
final_string += string
print(final_string)
return final_string
Please
On 05/21/2012 07:24 PM, Alan Gauld wrote:
On 21/05/12 15:23, wolfrage8...@gmail.com wrote:
if any of these formats offer file locking with in them, ;et me say
that better. Can I open a, as example, tar file and lock a file with
in it, with out locking the entire tar archive?
No and you
I think you mean the Zen of Python:
http://www.python.org/dev/peps/pep-0020/
The command is
import this
--
Jordan
On 09/15/2011 11:19 AM, Richard D. Moores wrote:
You know, at the interactive prompt you enter some Monty Python word
that I can't remember, and you get a small list of pithy
of the file if I make field 2 of file 2 equal 01?
--
Jordan
On 09/06/2011 09:46 PM, lina wrote:
HI, I have two files, one is reference file, another is waiting for adjust
one,
File 1:
1 C1
2 O1
3 C2
4 C3
5 H3
6 C7
7 O2
8 H22
9 C6
10 H61
11 C5
12 H5
13 C4
14 C8
15 C9
16 C10
17
(self):
MoveableSprite.update(self)
AnimatedSheetSprite.update(self)
--
Jordan Farrell
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
assume the mailing list are posted some wheres on-line.
But I can only find the sign up page. Thanks in advance for the link.
--
Jordan
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman
Hey everbody,
If we have 100 apples, for example, and we need to distrubte the 100 apples
randomly in 10 boxes, how can we do this in python?
Cheers
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Martin Walsh wrote:
def addcommas(f):
This amounts to reversing everything left
of the decimal, grouping by 3s, joining
with commas, reversing and reassembling.
# assumes type(f) == float
left, right = ('%0.2f' % f).split('.')
rleft = [left[::-1][i:i+3] for i in
Any one here using cutter... http://www.fundza.com
Free Java based ide with many built in functions and bindings. This is an
especially useful tool if you are doing 3d or any kind of shader writing.
Jordan Reece Halsey
maya | mental ray | renderman | nuke | houdini | ae
www.jordanhalsey.com
it
is not as straight forward as
preprocessing html, but it amounts to the same.
Let me know if that helps,
Jordan
On Mon, Jun 9, 2008 at 7:21 AM, W W [EMAIL PROTECTED] wrote:
Python can *too* import from a txt file (even if it contains HTML):
f = open(myfile.html, r)
x = f.read()
print x
f.close
sorry about the spelling. that second sentence should be the work out
to be similar to php in the browser.
On Mon, Jun 9, 2008 at 9:57 AM, Jordan Kanter [EMAIL PROTECTED] wrote:
Another thing you can do is use django templates. they work to be
similarly to php in the browser, and have something
. If you're willing to spend some $$$, then PyDev Extensions
(also for Eclipse) are good, or ActiveState's Komodo IDE. They seem to
be the gold standard.
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo
/reruns are made. thanks for the tip on checking things with os.
On 8/2/07, Kent Johnson [EMAIL PROTECTED] wrote:
Luke Jordan wrote:
i've implemented a database as a shelve of record class instances. some
of the fields in each record are dictionaries.
i needed to parse info from 3 different
i've implemented a database as a shelve of record class instances. some of
the fields in each record are dictionaries.
i needed to parse info from 3 different reports into the dictionary fields
in each record instance. i wrote the code to do this and tinkered it to fit
the different reports (i.e.
I've created a database as a shelve, where each value in the shelve file is
a record class instance that has attributes representing fields. Let's say I
enter 300 records in the shelve, then I decide to add a field to future
records, or remove a field from future records. How can I update the
x.
Jordan
--
I prefer encrypted mail. My key is available at:
http://myweb.wit.edu/greenbergj/publickey.txt
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Smith, Jeff wrote:
I find a common thing to do is
l = list()
for i in some-iterator:
if somefum(i) != list:
l.append(somefun(i))
How about using the same condition you do in the if? Like:
l=[somefun(i) for i in some-iterator if not type(somefun(i)) is list]
HTH
Jordan
Toon Pieton wrote:
Hey friedly users!
I was wondering: how can I get the directory the program is in? For example
C:\Python Programs\Calculator\.
Thanks in advance for reading,
Toon Pieton
Slightly hackish and nasty, but seems to do the trick. Someone'll
probably suggest a better way,
[EMAIL PROTECTED]:~$ cd /
[EMAIL PROTECTED]:/$ python test.py
/home/jordan/test.py
[EMAIL PROTECTED]:/$
So, if you _ALWAYS_ need an absolute path, just using sys.argv[0] might
not work.
Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http
Chris Hengge wrote:
Anyone point me to something more efficient then
for item in list1:
if item not in list2:
list2.append()
This just seems to take a bit a time when there are thousands or dozens of
thousands of records just to filter out the dozen or so copies..
will come from there from now on.
Sorry again for the test,
Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
, but theres no object left to pass it.
HTH.
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
. In Python, what you'd think of as
'variables' are just names for objects. (If you know C++, think
pointers, sort of. myDie isn't the Die Object, its just a reference as
to where the object is. Assigning to a pointer doesn't change the
object, but what the pointer is pointing to.)
Hope this helps,
Jordan
]: test=5
In [7]: test
Out[7]: 5
(I could've written a test to show that __coerce__ is only called when
no __add__ is defined, but I'm lazy and its time to leave work!)
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
; ifoo.length; i++) {
System.out.println(foo[i]);
}
}
The equivalent code in python is much cleaner, after foo has been
initialized to whatever:
for each in foo:
print each
Hope this helps,
Jordan Greenberg
care of the basics for ya. Later you could try and keep
frequency counts over a bunch of trials, see if the human has a
preference, and then weight your response appropriately to try and beat
them ;)
-Jordan Greenberg
___
Tutor maillist - Tutor
Hope this helps!
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hans Dushanthakumar wrote:
Hi,
How do I use python for basic web-tasks like inputting data or
clicking buttons on web-pages. For eg, how do I enter my username and
password and click on the OK button on the yahoo mail page?
I had a look at the webbrowser module documentation
):
:print kwargs
:
In [16]: foo(name=Jordan, email=[EMAIL PROTECTED])
{'name': 'Jordan', 'email': '[EMAIL PROTECTED]'}
Your functions can then use the list/dictionary as normal.
You can also use these in conjunction with normal positional parameters:
In [27]: def foo(a, b, c, *args
have lists? Then Queues and Stacks are
trivial to implement once you've got lists.
If you're interested in learning more about data structures and their
uses, this looks like a good reference:
http://www.brpreiss.com/books/opus7/
-Jordan Greenberg
Thanks for this insight into classes. It often takes me a few days to absorb and respond because my job limits the time I can give to programming. But thanks again for taking the time torespond in a meaningful way.
Iguess I could say that you changed my world when it comes to programming (sorry,
garbage cansIt's just that I can't pin down how to automate it, say through a loadAllMaps() func.
Thanks again for your helpful advice!
Luke
On 10/19/05, Danny Yoo [EMAIL PROTECTED] wrote:
On Wed, 19 Oct 2005, Luke Jordan wrote: I've got a bunch of pickled class instances with
self.namehttp
I've got a bunch of pickled class instances with self.name attributes, and I would like toassignthe instances themselves to variables named whatever is stored in
self.nameusing a function. Can't assign to literal, right? Is there a way to do this?
Thanks,
Luke
I've got a bunch of pickled class instances, and I'm trying to load them as variables using a function. The class has a self.name attribute, and I've got a list of
self.name for all the instances pickled separately. When I would like to attach the names of each instance to the corresponding class
Sincerely, Luke
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
Another stumped beginner here.
I'm trying to have functions to create, edit and store dictionaries within a class. WhatI can't figure out is how to retain the edits after making them. I think it has something to do with namespace. Ideally I'd like to pickle class instances and be able to
Thanks for the help everyone, for answering a simple question and pointing me toward more resources.On 9/24/05, bob
[EMAIL PROTECTED] wrote:At 08:11 AM 9/24/2005, Luke Jordan wrote:Hi All,
I have spent an embarrassingly large amount of time trying to solve whaton its face seems like a simple
Hi All,
I have several frighteningly cumbersome reports to review at my new
job. I would like to write a python program to help me with my
analysis. The goal of the program is to filter out information that
doesn't meet certain requirements and print relevant results back to
a legible report
Hi!
I am using a suggestion from this list to handle calling different
functions conditionallly based on user input. What I'm trying to do is
have functions that are 'configurable' in the sense that a choice from
the user affects the way it performs.
This works:
def aFunc():
print
Yes, Danny - that makes sense. I was getting hung up how to handle the
parens in this part
dict['some'](thing)
all clear now.
:-)
On Apr 7, 2005 4:40 PM, Danny Yoo [EMAIL PROTECTED] wrote:
On Thu, 7 Apr 2005, Luke Jordan wrote:
I am looking for a little clarification of how exactly
Hi!
My questions arose from reading the Help with Classes email that's
been on this list for the past couple of days.
I'm also writing a text game, but mine is puzzle not adventure.
Anyway, someone mentioned that you can key words to a dictionary to
have user input run functions.
I am looking
Hi -
I'm working on a command-line game. Is there anything wrong with
having each 'chapter' of the game be a function that links to other
chapters by calling them? I only ask because when a recent traceback
returned about 40 lines worth of error message, I realized that the
functions are all
Hi all,
I've tried a lot of experimenting and searching through various
tutorials, and I haven't been able to come up with a solution to this,
ostensibly simple, problem.
I'm writing a simple game (run in command line) in which narrative
text is printed in response to a user's decisions. The
Execllent.
Many Thanks,
Luke
On Thu, 24 Feb 2005 13:15:41 -0500, Bill Mill [EMAIL PROTECTED] wrote:
On Thu, 24 Feb 2005 13:14:13 -0500, Bill Mill [EMAIL PROTECTED] wrote:
On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan [EMAIL PROTECTED] wrote:
Hi all,
I've tried
72 matches
Mail list logo