Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Calculate the Euler Number with more decimal places
Post: RE: Calculate the Euler Number with more decimal p...

You might want to consider Anaconda ( https://www.anaconda.com/products/individual) instead of installing everything on your own distribution, I think it makes life easier and you have almost everythi...
Otbredbaron General Coding Help 10 4,544 Oct-22-2021, 12:57 AM
    Thread: Grouping and sum of a list of objects
Post: Grouping and sum of a list of objects

Hi, I have a list of objects with certain attributes: I would like to group them and then calculate the sum of one of their attributes. I'll try to explain better with an example: from itertools im...
Otbredbaron General Coding Help 1 3,231 Oct-21-2021, 09:38 PM
    Thread: Sorting list of names by first two characters
Post: RE: Sorting list of names by first two characters

Yeah, I forgot to temove the reverse flag because I was trying it a little bit. About the input I don't really like what I wrote but I couldn't find a better way
Otbredbaron Homework 2 3,283 May-24-2018, 03:59 PM
    Thread: Sorting list of names by first two characters
Post: Sorting list of names by first two characters

I need to sort a list of n names where n is read by input, which ends when n is 0. The thing is that the names must be sorted using only the first two characters and if two names have the same first ...
Otbredbaron Homework 2 3,283 May-24-2018, 01:09 PM
    Thread: Most used words in a list
Post: RE: Most used words in a list

Whoops, this is why I was getting some false positive in the tests... Thank you, I'll change approach following your hint
Otbredbaron General Coding Help 2 2,689 May-22-2018, 09:24 PM
    Thread: Most used words in a list
Post: Most used words in a list

Hi, I'm trying to solve this exercise: https://open.kattis.com/problems/conversationlog . I've managed to get a list with the words sorted by the number of occurrence but I'm still having troubles be...
Otbredbaron General Coding Help 2 2,689 May-22-2018, 07:06 PM
    Thread: Sorting list of lists with string and int
Post: RE: Sorting list of lists with string and int

(May-07-2018, 05:38 AM)buran Wrote: actually, the easiest way would be to add sorted to your line 5 list comprehension a = [sorted(input().split()) for i in range(n)]this way you always get the num...
Otbredbaron General Coding Help 6 4,207 May-07-2018, 05:54 AM
    Thread: Sorting list of lists with string and int
Post: RE: Sorting list of lists with string and int

Why do we need to be explicit and write except ValueError?
Otbredbaron General Coding Help 6 4,207 May-06-2018, 11:42 AM
    Thread: Sorting list of lists with string and int
Post: Sorting list of lists with string and int

So I'm trying to solve this exercise: https://open.kattis.com/problems/cups Although the problem is simple and does not require much work I'd like to improve my code because it looks pretty bad: #!/...
Otbredbaron General Coding Help 6 4,207 May-06-2018, 04:26 AM
    Thread: Exercise about list of lists
Post: RE: Exercise about list of lists

Thanks for your answer, I think I almost got every point of your post (I'll write the function but I know how to do that so it's not an issue): #!/usr/bin/python3 L = [[1,2,3],[5,6]] a = [sum(i) f...
Otbredbaron General Coding Help 3 3,040 May-03-2018, 08:30 PM
    Thread: Exercise about list of lists
Post: Exercise about list of lists

Hi, I'd like to know if this is the correct way to approach this kind of problem. Basically I need to store the sum of every list of L in a new list. For example: [[1, 2, 3], [5, 6]] => [6, 11] #...
Otbredbaron General Coding Help 3 3,040 May-03-2018, 07:43 PM
    Thread: Usage of argparse with a single option
Post: RE: Usage of argparse with a single option

Doc says that optparse is deprecated but it can be asily adapted that to argparse, thank you
Otbredbaron General Coding Help 3 3,442 Feb-24-2018, 01:47 PM
    Thread: Usage of argparse with a single option
Post: Usage of argparse with a single option

Hi, I'm trying to use argparse to handle a single command line option, this is the code that I wrote: #!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser(description='foo') parse...
Otbredbaron General Coding Help 3 3,442 Feb-21-2018, 11:44 AM
    Thread: About generating N integer numbers without repetition
Post: RE: About generating N integer numbers without rep...

Thank you so much, well I wasn't expecting a function like this, good news
Otbredbaron General Coding Help 3 3,891 Jan-30-2018, 12:08 PM
    Thread: About generating N integer numbers without repetition
Post: About generating N integer numbers without repetit...

Hello everybody, I wrote this small piece of code to generate N numbers without repetition. The algorithm should be fine but since I'm learning Python I'd like to know if my code is correct and if it...
Otbredbaron General Coding Help 3 3,891 Jan-30-2018, 01:12 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020