« first day (1627 days earlier)      last day (3319 days later) » 

9:00 AM
@InbarRose No, I did a str.split(',') first.
 
@poke Not sure I follow.
 
user4433485
elif question == "b":
this method is correct? using "elif"
 
@InbarRose You said 8 which matched the number of line entries; but Jerry and Ffisegydd were on a single line, separated by a comma. So to get the correct count, I split it by a comma first.
@Katherina Yup, elif is Python’s “else if”
 
user4433485
I don't get it working tho
 
full if block?
 
user4433485
9:03 AM
print('If you know me, Try to answer this question:')
question = input("What were the best years in history for partys?")
print("a. 1920")
print("b. 1980")
print("b. 1990")
if question == "a":
print("Correct! Lets find out a way to get back to the twennys")
elif question == "b":
print("The 80s were great specially the happy hardcore but I prefer the 20s")
elif  question =="c":
print("The 90s were great, but I prefer te 20s")
else:
print("Go back to school..")
 
hmm, need some indent there :) Try edit, use Ctrl+K then enter
 
Don’t you want to print the choices first before asking the user to enter a/b/c?
 
user4433485
I had already Ctr+k
 
hm weird
 
user4433485
uh yes
 
9:05 AM
print('If you know me, Try to answer this question:')
print("What were the best years in history for partys?")
print("a. 1920")
print("b. 1980")
print("c. 1990")
question = input("What is your answer? ")
if question == "a":
    print("Correct! Lets find out a way to get back to the twennys")
elif question == "b":
    print("The 80s were great specially the happy hardcore but I prefer the 20s")
elif question == "c":
    print("The 90s were great, but I prefer the 20s")
else:
    print("Go back to school..")
 
Is that what your actual indentation looks like?
 
user4433485
when I run it : Expected an indented block
 
user4433485
Thanks @poke now I need to check what you actually did
 
user4433485
@Ffisegydd ?
 
I indented the lines
 
9:06 AM
Well in your code nothing is indented. In Python blocks are controlled by the indentation.
 
if <something>:
    indented means that it belongs to the condition
no longer part of the if
 
user4433485
O right..
 
user4433485
Thanks :)
 
@Katherina or... normally, you'd do a dictionary dispatch instead of the if/elif/else... but
 
It’s funny how you are asking that question when you haven’t been around for either year :P
 
user4433485
9:12 AM
:p
 
user4433485
I know my history
 
user4433485
chicago & 1920, all that jazz :D
 
I wish I could live in 1920s society with the comforts of today. I wouldn't necessarily need the internet or anything, but running hot water and indoor toilets would be nice.
 
user4433485
Exactly @Ffisegydd I wouldn't need computers or internet :)
 
user4433485
those clothes in the 20's, awesome
 
9:20 AM
@JonClements Was gonna say.
 
@Inbar well - it got no further interest, so I'll just say stuchm
 
user4433485
@JonClements oh sorry, I got somewhat distracted, dictionary dispatch?
 
@Ffisegydd They had that in the 20's....
 
@Inbar depends on the place.
 
user4433485
I need to find the translation :p
 
9:24 AM
@Ffisegydd True. But since we are not decided on a place, only a time. I it was fare game.
@Katherina Are you answering his(her?) question @JonClements ?
 
Wow - interleaved conversations or what :)
 
user4433485
I don't know what he is saying actually, my english ain't fluent mate :(
 
user4433485
Try'd to translate it tho:p
 
user4433485
could you repeat @JonClements
 
JonClements
done :p
 
user4433485
9:29 AM
Lol bot
 
user4433485
:p
 
user4433485
Anyway
 
user4433485
the code is working:p
 
responses = {
    'a': 'Correct! Lets find out a way to get back to the twennys',
    'b': 'The 80s were great specially the happy hardcore but I prefer the 20s',
    'c': 'The 90s were great, but I prefer the 20s'
}

print(responses.get(input('What is your answer? '), 'Go back to school..'))
that's the way I'd do that code
(obviously add in your prints at the top)
 
user4433485
ah I see
 
user4433485
9:35 AM
it's cleaner
 
@Katherina plus then you have responses in one place
 
user4433485
Yes I see
 
user4433485
better overview
 
...
As a script that uses that idea.
It's a bit long. Let me fix it up.
 
user4433485
kk:D
 
9:39 AM
def ask_question(question, choices, prompt=None, invalid=None, retries=3):
    print question
    print '\n'.join(['{}: {}'.format(key, val['prompt']) for key, val in choices.items()])
    while retries:
        response = raw_input(prompt)
        if response in choices:
            print choices[response]['result']
            break
        print invalid
        retries -= 1
 
@InbarRose if it's really long - then put it in a gist/paste site mate :p
 
This is the function.
question = '''If you know me, try to answer this question:
what were the best years in history for parties?'''

choices = {'a': {'prompt': '1920',
                 'result': 'Correct! Lets find out a way to get back to the twennys'},
           'b': {'prompt': '1980',
                 'result': 'The 80s were great specially the happy hardcore but I prefer the 20s'},
           'c': {'prompt': '1990',
                 'result': 'The 90s were great, but I prefer the 20s'}}

prompt = 'what is your answer? '
The variables.
ask_question(question, choices, prompt, invalid)
The func call
Put them together and see what happens.
BRB
 
user4433485
I've been hesitating for 2 days now to ask about this, it seems so damn easy ^^
 
user4433485
Thanks @InbarRose
 
think that loud bang mighta been my garden fence smashing into something
 
user4433485
9:41 AM
lol
 
Nothing like more expense to rock your day, hey?
 
user4433485
What do you mean
 
well - replacing the fence, and might be liable for any damage caused by it being blown across a garden or two
 
@InbarRose Your and Jon’s code somewhat lacks something to show that a is correct.
(other than that result message)
 
@poke how doesn't mine do that?
just going by the same logic etc...
 
user4433485
9:45 AM
print question  gives me error when I run @InbarRose code
 
I mean it’s just a answer -> response text logic. Nothing that actually tells whether the answer is correct or not (a user might want to retry if it’s wrong)
 
user4433485
missing paranthesses in call to "print"
 
@Katherina Try print(question)
 
@Katherina if you're using Python 3.x where print is a function and not a statement - that's to be expected
 
user4433485
print '\n'.join(['{}: {}'.format(key, val['prompt']) for key, val in choices.items()])
invalid syntax;p
 
9:46 AM
in Python 2, you could use print without parens
 
Python 3 is the sane choice.
 
user4433485
;)
 
@Katherina Wrap the whole thing after print around parens
 
We should all blame Inbar for posting Python 2 replies here.
 
@poke I have one system I'm obliged to maintain that uses 2.4
 
9:47 AM
tries to think of a 2.4 children joke
 
You’re dead to me
(xD)
 
user4433485
Vote ban the original @InbarRose
 
(oh, and boy is that painful)
 
@MartijnPieters Happy Birthday!!! :-)
 
user4433485
Can't wait lunch break:) 10 minutes to go
 
9:50 AM
@Katherina I get the impression that you spend most of your time waiting for coffee or lunch breaks, or 5pm :P
 
user4433485
@poke Well, You sir, have a very good impression
 
:D
 
user4433485
I've got nothing else to do at the moment
 
Lucky.
 
@Katherina Learn. Learn as much as possible.
 
user4433485
9:52 AM
I finish my internship here in 8 days, they can't give me a new project;)
 
user4433485
@thefourtheye I am trying :)
 
What are you going to do then?
 
user4433485
Back to school
 
Oh
 
@Katherina Why don't you take a look at SOPython Org?
 
user4433485
9:54 AM
I don't think that I can do something useful I'm afraid
 
user4433485
I've been stuck on a if else statement for 2 days dude
 
user4433485
:p
 
Well, once you get past the beginner pit, its a blissful land :-)
 
You just need to ask earlier?
 
user4433485
@thefourtheye I know it is:) That's why I have to learn
 
user4433485
9:56 AM
@poke Maybe, but it's quite ehm. embarrassingly
 
user4433485
to fail on a simple if else.
 
Hmmm... Try hackerrank.com. You might find it interesting.
 
Well, what’s worse? Fighting with it for two days and then asking, or just asking immediately? ;P
Seriously though, we all have started at some point, and we all have seen worse questions before ;)
 
or google code jam 2015!
projecteuler is also fun
 
user4433485
@poke ah well I will try to ask somewhat faster, but obv not immediately
 
user4433485
10:01 AM
I brb ! Lunch !
 
10:12 AM
Cabbage folks
 
@Katherina I personally fight for at least a week until I ask lol. Unless the pressure is not from myself
cbg @IntrepidBrit
 
Getting to Python today. Today is a good day
 
\o/
 
@IntrepidBrit You've made one with your 3D printer stuff! Awesome :p
 
... no, but that would be something awesome to showcase. Hmm
Damn you Jon
 
10:28 AM
I'll forever be held Damned diving into the cliff of insanity of the cliff of crazy... don't add more to my list :p
 
Oh, but I will - "into the Sea of endless mild itchiness"
That'll learn ye
 
user4396006
10:42 AM
-2
Q: "Read More" for Django WYSIWYG editor

TanayI am using django-summernote editor for creating posts with text and images which are saved in a character field as HTML tags. I want to add a read-more functionality where a limited sized preview is shown for all the posts. An idea could be to truncate the character field, but it may lead to t...

 
What about it @JuanRocamonde?
 
user4396006
Well, I think it is kind of off-topic. Isn't it? @Jerry
 
Yea, I don't know much about Django, but it looks like this Django editor is some sort of open source software; which I guess would be better on superuser
then again, the question asks for 'better ways' to do something, which tend to also be opinion based
 
@JuanRocamonde this is how you say that:
If you think it should be closed
@Jerry it's definitely opinion based
 
user4396006
I was just asking in case I thought it should be closed but maybe it was totally appropriate here
 
user4396006
10:47 AM
So i didn't want to put my foot in it
 
ok, remember that just posting a question here doesn't immediately say what you think about it :P
so many users just come here and just put their question here in hopes to get it answers quicker
 
user4396006
Ok. @Jerry. :)
 
user4396006
No, i did not want that.
 
hi guy, i've got a silly question ;(
how can i realize this part of code on python?
"for (int i=0; i<=100; i+=2) { ... }"

the problem is that i+=2 is not working in python as i expected
for i in xrange(0,len(list)-1):
print i
i+=2
 
user4396006
you can't use xrange in py 3.x I think
 
user4396006
10:52 AM
BTW, range function has a third argument which is step, which tells how many numbers to skip
 
its not python 3, its 2.7
 
user4396006
Ok, that one then
 
user4396006
 
@PYPL Is your indentation OK?
 
oooh i didnt know about that skip step argument
 
user4396006
10:53 AM
Use the step argument (the last, optional):
for x in range(0, 100, 2):
print x
 
@matsjoyce it was ok before i hint the enter button :)
@JuanRocamonde okay that what i need, thanks
 
user4396006
vote the question up if you consider it helpful :D ...just kidding
 
@PYPL Next time, hit fixed font before posting, that sorts it out
 
or Ctrl+K
 
user4396006
What about mac @Jerry ?
 
10:56 AM
I don't use Mac, I have no idea :s
 
user4396006
Cmd-K?
 
user4396006
Ok Thanks though
 
user4396006
Yes it's still ctrl-k
 
ok, now I know too =P
 
user4433485
I am back!
 
user4396006
10:58 AM
cbg to u
 
user4433485
Looking for little project I could do with Python
 
user4433485
any suggestions?
 
People ask that a lot.
 
We should get a canonical answer for it ;)
I presume you've tried to press-gang her into SOPython stuff?
 
user4433485
Well it's not easy to start a project to learn, because I don't know what we can do with Python
 
user4433485
11:04 AM
the limits etc
 
that's where you discover them :)
 
@Katherina Heresy, Python is limitless!
 
user4396006
Don't freak out, @matsjoyce
 
@JuanRocamonde But, but, but ... OK...
 
@Katherina In in that case, keep an eye out during your day and look for little problems to solve
 
user4396006
11:08 AM
:)
 
@Katherina honestly? You can do anything in Python. Really. Some things may not be as good as doing them in say C++, but you can do anything.
 
user4396006
@Ffisegydd that's it.
 
user4433485
but you can't make programs with Python right? like .exe files
 
Yep.
 
user4396006
Yes you can
 
11:09 AM
@Ffisegydd And if C++ can do something Python can't, just wrap C++ into Python, and then Python can do it.
 
py2exe and cx_freeze are two that spring to mind.
 
user4396006
Python is not like PHP
 
user4396006
(I mean in terms of compiling)
 
user4433485
so basicly, you can make a mp3 player with Python?
 
PHP is a Turing-complete language though no? So technically anything you can do in Python you could do in PHP.
 
user4396006
11:10 AM
Yes
 
Of course.
 
user4396006
But you will need hardware for that
 
@Ffisegydd Except that PHP is PHP.
 
user4433485
what kind of hardware @JuanRocamonde, ive got my pc ;p
 
user4396006
@matsjoyce 😂
 
user4396006
11:11 AM
Well I mean if you actually want to build a MP3 player
 
user4396006
You can code it to work without anything but if you want to be able to have a device you can touch and manipulate you need a board
 
user4396006
like Beaglebone, Raspberry pi, arduino (only c++)
 
user4433485
I meant a program like music player
 
user4433485
;)
 
11:12 AM
(I suspect she's meaning a piece of software that plays mp3 files?) See above
 
user4433485
yup:P @IntrepidBrit
 
user4396006
Ah
 
user4396006
Then yes
 
Happily, it can do both anyway ;)
 
11:13 AM
Gstreamer's got a python binding which I've used before
 
user4396006
You can do both CLI and GUI, for the latter you can use a framework
 
user4396006
@FFisegydd I do not know any of those
 
user4433485
Oh well I can't do the mp3 player as project since I've no sound on this pc ^^ won't be able to test it etc
 
user4396006
Why don't you have sound there?
 
user4433485
11:15 AM
Will try to make a auto clicker.
 
user4396006
Haven't you got speakers?
 
user4433485
Nope
 
user4396006
Well you should really consider buying ones @Katherina xD
 
user4433485
well it's at the office anyway
 
user4433485
I am currently at work:p
 
11:16 AM
Headphones?
 
user4433485
I have them, connected to phone since cable is not long enough to reach the pc:p
 
user4396006
Ah @Katherina working and chatting... Pretty nice... :P
 
Happily enough, you can code Python on android. Problem solved :)
 
user4433485
let's say , I'm not so productive in my work
 
Just use the CPU to rev the fan.
 
user4433485
11:17 AM
@IntrepidBrit but that is very difficult ;p
 
user4396006
@IntrepidBrit I wouldn't use my phone to test my python code
 
user4396006
Basically because it's an iPhone and i cant, even if I could :D
 
@Katherina Lets say there is alot of developing overhead
 
@JuanRocamonde Serves you right for having an iPhone :P
 
user4433485
Ive got a samsung galaxy s5, terrible phone tho
 
user4396006
11:18 AM
@IntrepidBrit lettuce?
 
user4433485
Will sell it and buy myself iPhone 6 =D
 
user4396006
@Katherina why do you say so? It's a good phone
Or that's what they say
 
@Katherina Nuh-uh. Just download the Python interpreter and get your code running on it. I often code on the bus to try out different ideas
@JuanRocamonde Just being facetious
 
user4396006
ah
 
user4433485
about that project
 
user4433485
11:19 AM
I will need a GUI
 
Coincidentally, the facetious is the smallest word with the letters aeiou in the correct order :)
 
user4433485
I heard about Tkinter?
 
Or so the significant other tells me ;)
 
user4396006
@IntrepidBrit yes! :P
 
Hei
 
11:20 AM
is there a salad word for happy birthday?
 
user4396006
Don't think so @Bonifacio2
 
user4396006
@Emyen cbg
 
Beans Carrot Tomato :P
 
Closest is probably Pineapple.
 
11:21 AM
What's a salad word?
 
user4396006
@Emyen words that we use in the chat room
 
user4396006
Which casually are taken from fruit and salad names :P
 
Hehe
Yam
 
@JuanRocamonde Is laurel a fruit or salad? I thought it was a bush?
 
user4396006
11:23 AM
well...
 
user4396006
@matsjoyce most of them
 
user4396006
Say plants in general
 
Grass plant sort of
salad is that the green coloured grass people eat?
 
A salad is a dish consisting of small pieces of food, which may be mixed with a sauce or salad dressing.) Salads can incorporate a wide variety of foods including vegetables, fruits, and cooked meat, eggs, and grains. Garden salads use a base of leafy greens; they are common enough that the word salad alone often refers specifically to garden salads. Other types include bean salad, tuna salad, fattoush, Greek salad, and somen salad. The sauce used to a flavor a salad is commonly called a salad dressing; well-known types include ranch, Thousand Island, and vinaigrette. Most salads are served cold...
 
user4396006
yes ;'-)
 
user4396006
11:24 AM
Are you kidding? @Emyen
 
No in norway we call it "salat".
 
Salad is that "food-what-isn't-meat" right?
 
@Ffisegydd Rabbit food.
 
That's the bunny.
 
When they're mixed in like mixed..
 
11:30 AM
 
@matsjoyce I love that cartoon
 
thefourtheye has approved 222 edit suggestions and rejected 124 edit suggestions
 
user4396006
@RobertGrant just for curiosity, but seriously, should that be called cartoon?
 
It would make me look like a strict reviewer...
 
My stats are wrong for some reason :/
 
11:34 AM
@JuanRocamonde the electric shocks thing?
 
@thefourtheye Where can I see those stats?
 
Oh, hah, no not the salad thing
 
Ffisegydd has approved 177 edit suggestions and rejected 5 edit suggestions <- that is way out.
 
No, I was referring to the cartoon he posted
 
user4396006
@Robertgrant no, the actual "photo" @poke posted
 
11:35 AM
@poke I found a suggestion on a question and I rejected it. When I opened it again, it shows that stats.
 
@JuanRocamonde I said @matsjoyce...
 
user4396006
yes I know, but I want to know if that's the appropriate term to call it
 
But to answer your question, no, the photo of the rabbit definitely shouldn't be called a cartoon
 
user4396006
Ok, thank you
 
> poke has approved 297 edit suggestions and rejected 70 edit suggestions
 
user4396006
11:36 AM
How many reputation is it required to be able to approve/reject edit suggestions?
 
My numbers are wrong for two reasons. 1) The total doesn't add up to my actual total edit reviews. 2. There is no way in hell I've only rejected 5 edits. I'm pretty sure I've rejected a lot more than I've approved.
 
@poke Where did you find it?
 
@thefourtheye Same way you did.
 
Hmmm, SO should make it easier to see that no?
 
yeah
 
11:40 AM
@JuanRocamonde 2 or 3k
 
user4396006
So exactly 2 or 3k? :P @Bonifacio2
 
user4396006
ok thanks
 
Ffisegydd has approved 177 edit suggestions and rejected 251 edit suggestions <- That's much better ^_^
 
@Ffisegydd Wow. You’re a real hero.
 
11:45 AM
Not all heroes wear capes.
 
@JuanRocamonde Just 500.
 
user4396006
You sure? To approve/reject edits? @poke I have 600 and I cant
 
I’m pretty sure you should be able to review.
 
2k for edits, 3k for closes. Then the next important step is 10k for (certain) deletions.
 
user4396006
11:47 AM
Edit Questions And Answers

Privilege Type: Moderation Privilege
Awarded At: 2,000 Reputation
 
@poke Nope. Reviewing edits is 2k.
 
user4396006
That's it
 
Oh, there at the bottom.
 
_o/
 
The birthday list is still so short…
 
11:55 AM
@poke I'll add mine.
 
CBG :)
 
done
i wish this room had more book/blogs/reading material recommendations
 
Feb 26 at 12:37, by 61612
I like the idea of writing the official sopython's Python guide/tutorial. Not a rewarding task though.
 
We have a Martijn AI. What more else could you possibly want?
 
@Bonifacio2 More?
 
11:59 AM
Oh It's NINJA day today
 

« first day (1627 days earlier)      last day (3319 days later) »