[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
how the fk do i do this pls
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 73
Thread images: 15
File: python 3.5.0.png (29 KB, 785x337) Image search: [Google]
python 3.5.0.png
29 KB, 785x337
python 3.5.0
>>
Recursion
>>
>>53603787
sent ;)
>>
yeah- added
>>
>>53603787
DELETE THIS
>>
>>53603802
asif u hijack my help like that im the op not u
>>
>>53603835
>>
>>53603787
what a cuck
>>
>>53603763
If he had some mental block that prevented him from figuring out this completely trivial question, then this answer should have provided him with all the pointers he needed.

Any further help you give OP will make him lazier and dumber.
>>
>>53603850
>>53603885
OP here. Please delete these posts.
>>
>>53603993
ure not op u fucker i am
>>
File: Clayton_-_Monash_University.jpg (3 MB, 2288x1712) Image search: [Google]
Clayton_-_Monash_University.jpg
3 MB, 2288x1712
how's school opie?
>>
Install gentoo
>>
File: duh.jpg (56 KB, 616x504) Image search: [Google]
duh.jpg
56 KB, 616x504
>>53604030
what a nigger tier univ...op must be a retard
>>
>>53604143
lol fuck youj
>>
hey it's dave here did you guys solve it yet
>>
>>53604213
your mum solved it last night
giggity
>>
>>53604213
no. post the answer
>>
>>53603729
>>
>>53603729
Please ask this in the dedicated homework board: >>>/hm/
>>
>>53604254
more on the way
2/5ish
>>
>>53604271
>>
>>53604279
about to pick up
>>
>>53604279
when will they learn?
>>
>>53604308
>>
>>53604271
What is wrong with your screenshots?
>>
Not OP here
But can't this be done with a for loop that starts at the smallest fraction and then works outwards and then adds +2 when it's done?
>>
>>53604030
looks more like a prison desu senpai
>>
>>53604324
>>
>>53604331
Of course it can.
>>
File: 1453184596905.png (77 KB, 802x728) Image search: [Google]
1453184596905.png
77 KB, 802x728
>>53604326
yeah idk mate

here's the sauce
https://archive.rebeccablacktech.com/g/thread/S52501542
>>
File: 1453188970289.png (117 KB, 918x830) Image search: [Google]
1453188970289.png
117 KB, 918x830
>>53604357
>>
>>53604326
you just zoom in. 4chan has a gay 5000px limit
>>
>>53604368
>based on his hex data
wat
>>
>>53604385
I'm talking about the initial zoom if you display it at 100 %.
>>
>>53604368
>identified the student by name, based on the hex data in his screen capture
>hex data
>hex
>data

my fucking sides
>>
>>53604387
it's a bluff. otherwise he'd just say
>also i identified that it's _____ based on the hex data. do with that information whatever you want
>>
Is this seriously what passes for a a difficult problem? Are you doing a "CS" major at a community college or something? This literally took me less than 2 minutes to figure out.

n = input('OP how fucking stupid are you? Enter n:')
fraction = float(n + 1)
for i in reversed(range(1, int(n) + 1)):
fraction = i + i / fraction
result = 2 + 1 / fraction
print(result)


By the way, I didn't go to university. University isn't going to teach you not to be a retard. Study this code and figure out how it works or you are wasting your parent's money.

Bernie Sanders wants free college for retards like OP, btw. Trump 2016.
>>
jquery has a plugin called jmath! you should try it!
>>
this shit looks easy
Maybe after lunch I'll post something
>>
>>53604624
this is supposed to be an exercise of your understanding of recursion, but since you didn't get any formal education in this subject you understandably used the most familiar approach that made sense to you.

this is the cliche fear among companies considering hiring people that never went to university - that you know a few tropes really well but were never forced to understand the more complicated stuff because the University of Hard Knocks doesn't force you to learn everything from A through Z; you just need to figure out how to make a few things work well enough to get by.
>>
>>53604624
learn a functional language and learn recursion, you'll learn it in uni good luck
>>
>>53604624
this doesnt even work in python 3.5.0 dude
what version are u using
>>
>>53604638
>>53604649

Hello samefag

n = input('LEL I DINT GO 2 UNI SO HOW COULD I UNDERSTAND RECURSION XD')
def college_is_for_faggots(i, n):
if i > n:
return 1
elif i == n:
return i + i / float(n + 1)
else:
return i + i / college_is_for_faggots(i + 1, n)

print(2 + 1 / college_is_for_faggots(1, n))


I'm too busy earning money in the marketplace solving real problems using the best possible solutions instead of playing with my dick tinkering on academic/hobbyist languages in school.
>>
>>53604674

I'm using 2.7, but I'm sure it would work in 3.5 if you tweaked it slightly. They really aren't that different.
>>
>>53604676
You're too busy earning money in the marketplace solving trivial problems using the easiest scripting language in stead of working on interesting things, good job anon
>>
>>53604676
to be clear, you made this about university with your original post, like you had a huge chip on your shoulder. nothing about my post was aggressive or confrontational; you brought that emotional baggage with you.

chill out. also, don't make such stupid, hasty conclusions. if you get two posts that don't suck your dick, it's not a huge conspiracy or a ruse orchestrated by 1 person. Sometimes, 2 separate people are honest to go calling you out for not getting the point.
>>
>>53604707
>>53604716

Butthurt schoolies get TOLD: The thread.
>>
>>53604723
you either didn't read my post or didn't understand it, because i categorically shut you down on all points.

maybe if you're so riled up about how you didn't go to university you're just not seeing straight. i dunno. maybe you'll come back to this thread later calmed down and realize we were just offering help.
>>
>>53604732

You said that it was supposed to be a "demonstration of recursion" which the question does not at all address, retard. I posted, initially, the BEST solution (most efficient, least terse) to the question posed.

Then you criticized that solution as if it were naive, so I then followed up with the less efficient, more verbose example of a recursive function that solves the problem. Now you are grasping at straws and attacking my tone because my logic and solutions are flawless.

Basically kill yourself, faggot.
>>
>>53604772
>brainlet full on damage control
>>
>>53604676
Congratulations! You completed the first question to the first assignment of the first class you take at our university. We learnt it in the first week with no prior coding experience.
You're truly gods gift to the technology industry. Are you the next bill gates? I think so, anon.
>>
>>53604772
You're gonna crash so hard
>>
print((lambda reduce, n: 2+1/(reduce(lambda s, x: x+x/s, range(n-1,0,-1), n+n/(n+1))))(__import__("functools").reduce, int(input("Type in value for n:"))))


multiple lines are for fags
>>
>>53603729
Do something along the lines of
if (input == 2)
print(2.7272727272727275);
else if (input == 3)
print(2.7169811320754715);
>>
>>53604824

Yeah, I completed it in under two minutes, with two separate solutions. And you are sitting here talking down to me, even though I came up with the solution you could not.

>I don't even know how to code, therefore you are the fool!!!
>>
>>53605071
top kek
>>
>>53605162
I wasn't even the one who asked the question, I was actually the person who was going to help him.
It's literally the first question we're ever asked to attempt and you think you're some kind of PHD-level CS student cause you can complete it. Get over yourself.
Also your solution isn't 100% correct. I'd post mine but I don't want him copying it.
>>
>>53605230
Actually my solution IS 100% correct, you are a dipshit.

>some kind of PHD-level CS student

A useless wanker?
>>
>>53605253
Regardless of formal training you won't do well in life with a shit attitude like that
>>
>>53603729
python is a cancer
>>
>>53603729
https://play.golang.org/p/hzW6Hn2m2g

Just port it to python3
>>
def approximate(n):
e = n + 1
while n > 0:
e = n + n / e
n -= 1
e = 2 + 1 / e
return e

print(approximate(2))


Not sure where you guys get the idea that this has to be solved with recursion. Behold, my iterative solution.
>>
>>53605749
http://stackoverflow.com/questions/159590/way-to-go-from-recursion-to-iteration
or kill yourself
or even better
http://www.refactoring.com/catalog/replaceIterationWithRecursion.html
>>
>>53605781
What's your point?
>>
>>53605799
only your mom thinks you are special
>>
>>53605253
100% correct? You're taking n (a numerical value) as a string, leaving it as a string, and then comparing if an int is greater than it.
I can link you to some entry level python tutorials if you need help in this?
>>
>>53605845
he probably used python2, where input would evaluate it as a python expression, so it would inf act give an int not a string
>>
>>53605845


Maybe you need to read the tutorials yourself?
>>
>>53605892
>>53605908
He clearly stated 3.5 in the OP
So it's not 100% correct after-all?
>>
>>53605919
He said before he's using 2.7 (at least I think it was the same guy), and OP should tweak it for 3 himself.
>>
>>53605919

The only difference is syntax. Are you dumb?
>>
>>53603763
Not in python.
>compute_frac(999)
>maximum recursion depth exceeded in comparison
(used tail calls)
Thread replies: 73
Thread images: 15

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.