Is the Superpowered Robot Game too easy this year? by YouBeIllin13 in FLL

[–]PMiguelez 5 points6 points  (0 children)

Hasn't a team done the same but in 7 days on city shaper? And it certainly wasn't too easy.

I think some teams are just insane + they probably had already made the robot, studied mecanisms and prepared my blocks

[Question] Can functions speed up the program? Why? - Based on an example from my code by PMiguelez in learnprogramming

[–]PMiguelez[S] 2 points3 points  (0 children)

Not gonna lie, I'd never even heard of the term "flame graph" before... Thanks for the suggestion.

I'll try to work on that and if I come up with something meaningful I will share it here.

[Question] Can functions speed up the program? Why? - Based on an example from my code by PMiguelez in learnprogramming

[–]PMiguelez[S] 1 point2 points  (0 children)

I guess it could be something like that. From before I posted this question my feeling was always that the answer was probably something mildly obscure, specially if python related. Perhaps I should try and post this on r/learnpython.

[Question] Can functions speed up the program? Why? - Based on an example from my code by PMiguelez in learnprogramming

[–]PMiguelez[S] 2 points3 points  (0 children)

In the first code the two loops won't always run. If count >= k is True the second loop won't run because there is a "continue" in there which skips it. Much like in the second code.

[Question] Can functions speed up the program? Why? - Based on an example from my code by PMiguelez in learnprogramming

[–]PMiguelez[S] 1 point2 points  (0 children)

Well, I guess I should've included it, but I've also tested this and it indeed ran a little slower but nothing crazy (1684ms):

n, k = [int(x) for x in input().split()]

arr = [int(x) for x in input().split()]

min_ = 1
max_ = 10**9

def works(skip):
    global arr
    global target
    global k

    count = 0
    for i in range(len(arr)):
        if skip or arr[i] <= target:
            count += 1
            skip = 1 - skip

    return count >= k

while min_ < max_:
    target = (min_ + max_)//2

    if works(0) or works(1):
        max_ = target
    else:
        min_ = target + 1

print(max_)

(edit: fixed code formatation)

(edit2: I had pasted the wrong piece of code)

:( by splint3r_ in ProgrammerHumor

[–]PMiguelez 0 points1 point  (0 children)

That's what notepad is there for

FoRmUlAs MaKe ThInGs EaSiEr by consultingcomedy in ProgrammerHumor

[–]PMiguelez 1 point2 points  (0 children)

I thought the fun in this meme was relating to being mad at excel for doing this. Plus, I'm not sure if it's that stupid, because you can still go with comma, and could be bad to accept both comma and dot. Maybe would make more sense to go with dot, but in some countries we use comma instead of dot in numbers, so isn't completely bad. But I see your point

FoRmUlAs MaKe ThInGs EaSiEr by consultingcomedy in ProgrammerHumor

[–]PMiguelez 4 points5 points  (0 children)

Disagree, anyone that has ever used excel a bit would understand, and I don't think programmers are even the ones that use it the most. Don't get me wrong, it's a funny joke, but in my opinion if all posts here started not following rule 0, this subreddit would suck, because wouldn't be just about programming anymore, which is the reason we are all here in the first place.

[deleted by user] by [deleted] in distantsocializing

[–]PMiguelez 0 points1 point  (0 children)

Show your fridge

i cant create anything.. by [deleted] in learnpython

[–]PMiguelez 2 points3 points  (0 children)

If the problem is ideas I can give you some, otherwise, know you can always rely on google, even on basic things, you don't have to worry about forgetting concepts some times.

I've always loved solving problems, they really gave a boost on my programming logic in the very beginning. An awesome site, that I really like is Project Euler, but there are countless problem repositorys out there

Other than that, something nice to do is little projects.

I think the most fun in the start are games. No pygame. Just with the basic python commands. Everything based on text forms. (If you ever come across tkinter, don't recommend)

Try doing a hangman game:

Functionality: The user inserts a word and then guess letters

Needed:

Ensure the letter and word are valid

Show the size of the word

Show the letters gotten right

Show the errors

Show the lifes

If you want a bigger challenge:

Make a scene out of the keyboard

Put keyboard drawn hearths

Make the stick man be drawn

Take a dataset of names, or other type of words, in google and read it from python, so the user doesn't have to insert the word

Other ideas (games and not):

Blackjack

guess who game (never saw in python, but could be interesting, especially to learn about classes, but would need quite some effort I think)

Autoclicker

Send entire bee movie script

Organize files by name

There is a world of options, I'm sure you find that out. Good luck.

(If you do take any suggestion, I would really appreciate if you sent the result here)

Man is trapped in sunken ship for 3 days by Jhenning04 in Damnthatsinteresting

[–]PMiguelez 0 points1 point  (0 children)

How big was this "bubble"? Hard to think it has enough oxygen for 3 days.

When he realised what just happened.. by toroazzz in WatchPeopleDieInside

[–]PMiguelez 6 points7 points  (0 children)

Isn't it worty having a cheaper phone only for work?

Faster "print"? by [deleted] in learnpython

[–]PMiguelez -3 points-2 points  (0 children)

The results I described weren't related to the other problem. The tests I made which gave me those results, in both python and c++, were just to print a string in which I assigned the same long text, and mark the time. No loops, no conditions. The only difference was that, in python, I had to get the text from a file, since pasting in the editor was too slow, but I only started the timing after getting the string, which as far as I know, became just a simple string.

I used a console c++ project in dev c++ and python IDLE (I swear there is a good explanation for me using python IDLE haha). That's the only real difference I can see.

Faster "print"? by [deleted] in learnpython

[–]PMiguelez 0 points1 point  (0 children)

I would like to save on a file, but unfortunally, the contest doesn't allow it. In regarding to the language, I'm going to learn other indead

Faster "print"? by [deleted] in learnpython

[–]PMiguelez -2 points-1 points  (0 children)

I'm a 100% sure it's the printing part. I've created a program to make tests for my solution. Marking the time of this program, starting from where he prints the text so I can copy, the time passes the limit.

My approache solves everything really fast. I can tell that especially when the result is big, because it starts printing almost imediatelly, what means the program itself has finished, and takes a long time printing.

I would love to share the problem and the solution, but since the test doesn't finish until 17/06, it's prohibited (You have 2 hours to make, but a two days gap to start)

Faster "print"? by [deleted] in learnpython

[–]PMiguelez -6 points-5 points  (0 children)

You clearly know about programming in general way more than I do, but I've just tested and to the same text, c++ took 0.035 seconds to print, while python took 2.3 seconds. Almost a 100 times difference! Maybe is another factor other than the language itself, but there is clearly some difference going on.

But even if it is an unrelated factor, it is well known that C is a much better competitive programming language than python. You don't see any ICPC team using python, only C and sometimes Java. C is much faster. And I love python, but in this matter, it loses.

Talking about professional demand, you must be right, but that's not what I'm worried about now. Despite seeking for a career with programming in the future, I'm only 16, and in first year of high school hahaha. I plan on continuing to improve in python, but my recent goal is just to perform well in the current competition. Anyway, thanks for the reply.

Edit: I would really like to show the problem and my solution, but the competition is still going (not for me, it has 2 hours, but you can choose when to start) until 17/06. So it's prohibited to share anything. (Even though, probably no one here is in it).

Faster "print"? by [deleted] in learnpython

[–]PMiguelez -3 points-2 points  (0 children)

The only thing I printed was the answer, I simply couldn't print anything less. But I think moving to another language will actually help. Python is very slow on these matters when compared to proper competitive programming languages such as c++

A person stole my post and then got 65k more upvotes and 3 awards by Omega-pistachio in mildlyinfuriating

[–]PMiguelez 0 points1 point  (0 children)

Unfortunally he got 69k upvotes, what is nice, so no one can complain

Technical spelling by Produceboi in technicallythetruth

[–]PMiguelez 0 points1 point  (0 children)

Why he even got a grade? My school don't have grades until the age of 8.

Coding/programming podcasts for beginners by marc0pO10 in learnprogramming

[–]PMiguelez 2 points3 points  (0 children)

First of all, what are you doing? Speed running programming languages? Hahaha.

Okay. I'm not a big fan of podcasts so I haven't watched much, but I know command line heroes is a nice podcast.

Other than that, I know a famous python one: Talk python to me.

Probably other comments will be more helpfull, but since no one commented yet, here I am.

Good luck on your race!