[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

# The code is python # Why no print "You are neutral"

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 24
Thread images: 3

File: pyt.png (177KB, 640x453px) Image search: [Google]
pyt.png
177KB, 640x453px
# The code is python
# Why no print "You are neutral"
# Getting syntax error for line 4 but im still code kid who dont know how to fix

good_evil_level = 0
lawful_chaotic_level = 0

def (player_alignment_update):
if lawful_chaotic_level == 0 and good_evil_level == 0:
player_alignment = "neutral"

elif lawful_chaotic_level > 0 and good_evil_level == 0:
player_alignment = "lawful neutral"

elif lawful_chaotic_level == 0 and good_evil_level > 0:
player_alignment = "neutral good"

elif lawful_chaotic_level < 0 and good_evil_level == 0:
player_alignment = "chaotic neutral"

elif lawful_chaotic_level == 0 and good_evil_level < 0:
player_alignment = "neutral evil"

elif lawful_chaotic_level > 0 and good_evil_level > 0:
player_alignment = "lawful good"

elif lawful_chaotic_level < 0 and good_evil_level > 0:
player_alignment = "chaotic good"

elif lawful_chaotic_level > 0 and good_evil_level < 0:
player_alignment = "lawful evil"

elif lawful_chaotic_level < 0 and good_evil_level < 0:
player_alignment = "chaotic evil"

print "You are " + player_alignment
>>
>>384625630
What the fuck. This code is trash.
>>
>>384625630
>if lawful_chaotic_level == 0 and good_evil_level == 0:
player_alignment = "neutral"

You need to press TAB the "player_ali..."
has to me more to the right than the if
>>
>>384625630
go to stack overflow you retard cunt piece of shit
>>
>>>/wsr/
>>
>>384626675
>print "You are " + player_alignment
Also I don't think you need that + there
>>
If you went on the technology board they have code tags for you to use
>>
>>384625630
go read up on how to define a function
>>
>>384626791
you do, or you can use a comma instead
>>
don't quit your day job, OP
>>
>>384625630
Jesus, you're going about this all wrong. Make an empty string to start with, then add their lawful/chaotic string part to it. After that, append their good/evil string to it. If you want to say 'neutral' instead of 'neutral neutral' just add a case for it at the end.

Now you have 6 cases instead of 8. More importantly, you can add more cases without having to raise your number of 'if' statements by a factor of 2.
>>
>>384625630
def (player_alignment_update):
should be
def player_alignment_update():

also >>>/g/
>>
>>384627214
thank you u did it
>>
File: file.png (75KB, 921x662px) Image search: [Google]
file.png
75KB, 921x662px
This is python2.6, right? It works in py3. Did you fuck up your syntax horribly?
Either way, give up on programming anon
>>
>>384627346
Why would you put the name of the function in the brackets? I hope that was just a typo
>>
>>384627397
yep im using 2 should I go to 3
>>
Where's the CS graduate jpg when you need it.
>>
>>384627465
no I'm just bad this is pretty much my third day on the coding job
>>
/tg/ is that way, anon.
>>
>>384627639
>asking 4chan to fix code for your job
im worried for you anon
just look up everything on stackoverflow, worked for me
>>
>>384627610
A grad would at least know how to Google or Stackoverflow.
>>
File: You.png (110KB, 2093x2129px) Image search: [Google]
You.png
110KB, 2093x2129px
>>384627610
here
>>384627639
where did you find your coding job if you work so poorly
>>
cringy ass fag, kys
>>
>>384627556
Depends on what you're making.
Also, for the love of god write something that doesn't make your eyes bleed
https://pastebin.com/u284x0VX
Thread posts: 24
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.