On Thursday, August 8, 2013, Chris Down wrote:
> On 2013-08-08 02:40, Saad Javed wrote:
> > Chris has been emailing me directly. Thats why his responses are not
> > showing up in the conversation.
> > Dear Chris, please remember to send your replies to
> > tutor@python.orgwith
> > the subject of
On Wednesday, August 7, 2013, Alan Gauld wrote:
> On 07/08/13 15:41, Saad Javed wrote:
>
>> There was only Chris responding
>>
>
> Apparently he didn't CC the list so the rest of us didn't see it(*).
>
> is that what's confusing?
>>
>
> It's not just the lack of attribution but the fact we just d
On 2013-08-06 22:49, Saad Javed wrote:
> That causes:
>
> Enter string: These are my friends living in the same city as i am. I have
> known them for years. They are good people in general. They are:
> Traceback (most recent call last):
> File "chris_tweet_len.py", line 44, in
> print("\n".j
On 2013-08-06 22:31, Saad Javed wrote:
> Thank you for your response. This code has a bug.
>
> If there is one user left in the user list, it doesn't print a tweet with
> just that one user added. For example use this string: "These are my
> friends living in the same city as i am. I have known the
On 2013-08-06 14:40, Saad Javed wrote:
> It will add max no. of users to one tweet until limit is reached. I want
> all users added to the tweet. E.g. if 4 users can be added to the tweet
> before reaching the limit, return three tweets...first two with 4 users
> attached and the last one with thr
On 2013-08-06 19:42, Chris Down wrote:
> All that needs to happen is to move the pop to the top of the MAX_LENGTH
> check:
>
> while len(new_message) + len(add) <= MAX_LENGTH:
...or, better, remove the if...break and just do:
while users and len(new_message) + len(add) <= MAX_LENGTH:
p
On 2013-08-06 03:48, Saad Javed wrote:
> I want to add users to the tweet from the list, the no. of users added
> based on the length of the tweet.
It looks like you're using Python 2, but you didn't specify.
I'd probably do something like this:
#!/usr/bin/env python
MAX_LENGTH = 140
On 08/06/2013 03:18 PM, Chris Down wrote:
On 2013-08-06 18:36, Dave Angel wrote:
This version should be a bit cleaner than what I've seen on this thread.
Our methods are almost the same, other than the fact that you don't use a
generator, and you do the length validity check during the loop in
On 2013-08-06 18:36, Dave Angel wrote:
> This version should be a bit cleaner than what I've seen on this thread.
Our methods are almost the same, other than the fact that you don't use a
generator, and you do the length validity check during the loop instead of
preemptively, I'm not sure which I
On 07/08/13 15:41, Saad Javed wrote:
There was only Chris responding
Apparently he didn't CC the list so the rest of us didn't see it(*).
is that what's confusing?
It's not just the lack of attribution but the fact we just didn't see
the post to which you are replying.
(*)It is possible
There was only Chris responding to the question so I removed the line above
the quoted part in my responses that says "On Aug 6, 2013 11:36 PM, "Dave
Angel" wrote:"... is that what's confusing?
On Aug 6, 2013 11:36 PM, "Dave Angel" wrote:
> Saad Javed wrote:
>
> > I want to add users to the twee
Saad Javed wrote:
> I want to add users to the tweet from the list, the no. of users added
> based on the length of the tweet.
>
This version should be a bit cleaner than what I've seen on this thread.
#!/usr/bin/env python
LIMIT = 140
#(I use uppercase there to show it's a constant)
def send(m
I added *len(new_message) + len(add) <= MAX_LENGTH *to the outer while loop
instead of inner which threw an error. Your code works as expected. Thanks
a lot!
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
> I don't see how that differs from your expected output...?
>
> > I want all users added to the tweet. E.g. if 4 users can be added to the
> > tweet before reaching the limit, return three tweets...first two with 4
> users
> > attached and the last one with three.
>
> You hit the 140 character lim
>
> And the earlier fix now adds two users to a tweet, then one user, then two
> user, then one... :(
>
Enter string: These are my friends living in the same city as i am. I have
known them for years. They are good people in general. They are:
These are my friends living in the same city as i am.
> ...or, better, remove the if...break and just do:
>
> while users and len(new_message) + len(add) <= MAX_LENGTH:
>
That causes:
Enter string: These are my friends living in the same city as i am. I have
known them for years. They are good people in general. They are:
Traceback (most recent
> Ah, I see. Sorry, I misread your requirements. Something like this should
> work.
>
> #!/usr/bin/env python
>
> MAX_LENGTH = 140
>
>
> class TweetTooLongError(Exception):
> """
> Raised when a user would be too long to add to the tweet, even
> alone.
> """
>
> It looks like you're using Python 2, but you didn't specify.
>
> I'd probably do something like this:
>
> #!/usr/bin/env python
>
> MAX_LENGTH = 140
>
> users = [
> "saad", "asad", "sherry", "danny", "ali", "hasan", "adil",
> "yousaf",
> "maria", "bilal", "owais",
>
18 matches
Mail list logo