[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]

I'm beginning to learn Python. What is wrong with my code?

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: 21
Thread images: 2

I'm beginning to learn Python. What is wrong with my code?
-------
length = 10
width = 5

print "Area:" int(length) * int(width)
-------
>Pic unrelated
>>
Python sucks
>>
print("Area: " + int(length) * int(width))
>>
>>59519150
To further this, print is a function (look these up) which takes arguments, in this case, what you want to print.
>>
Stop learning python and get on C. Then learn something functional (not python).
>>
>>59519166
He is getting confused trying to print a line. Stick with Python.
>>
>>59519181
Haha this.
>what's wrong with my code?
computer please print "x" * "y" thank you
>>
>>59519124
>python 2
Found your problem
>>59519150
Nah do :
print "Area:", length*width
Instead
>>
>>59519259
computer make game
>>
File: game.jpg (15KB, 480x360px) Image search: [Google]
game.jpg
15KB, 480x360px
>>59519294
What game would you like to play?
>>
print('Area: {}'.format(length * width))
>>
>>59519181
He's confused because of the lack of syntactic constraints. He's doesn't understand that print is a function taking a list of arguments. He needs a more rigid looking language to alert his mind to what he's using.
>>
>>59519166
>>59519929
This
Beginners need to learn the fundamentals with a strongly typed programming language than some dynamically typed scripting language
>>
>>59519124
Your problem is that you forgot to add a whitespace after colon in "Area:".
It will print ugly "Area:666"
Disgusting...
>>
>>59519986
Jesus, kid. Being butt-frustrated isn't cool. Don't get bitchey just for the sake of it.
Your suggestion isn't even above disgusting. Look 3 posts up for the format function
>>
>>59519124
mommy... why is there no semi colons?
>>
Jesus christ python is shit
>>
>>59519124
>dat code
>>>/x/
>>
>>59519124
length = 10
width = 5
print("Area:"+str(int(length) * int(width))
>>
>>59519942
beginners don't need to know how to micro-manage low level shit the compiler can fucking do for you
>>
>>59520991
Err

length = 10
width = 5

print "Area: {0}".format(length * width)
Thread posts: 21
Thread images: 2


[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.