Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: A Programmer Named Tim
Post: RE: A Programmer Named Tim

https://python-forum.io/misc.php?action=help&hid=29 Wrote:User Titles The user title is assigned to users based on post count.
Yoriz Board 1 83 Mar-16-2024, 08:24 PM
    Thread: casting types rewrite
Post: RE: casting types rewrite

The print line has 3 opening brackets but only 2 closing brackets, add another close bracket to the end
Yoriz Homework 3 445 Jan-30-2024, 11:13 PM
    Thread: unable to remove all elements from list based on a condition
Post: RE: unable to remove all elements from list based ...

Removing an item from the list while looping over it changes the index location of the remaining items. You can loop over a copy of the list and remove items from the original list values=[6.2,5.9,4....
Yoriz General Coding Help 3 356 Jan-27-2024, 09:43 AM
    Thread: Code test
Post: RE: Code test

The code after the import is incorrectly indented but that could just be the way you have posted it. It asks that done() is used at the end
Yoriz Homework 2 356 Jan-14-2024, 04:02 PM
    Thread: Text conversion to lowercase is not working
Post: RE: Text conversion to lowercase is not working

The string method replace returns a copy of the string with all occurrences of substring old replaced by new. old_text = " A B C D " new_text = old_text.replace(" A ", " a ") print(old_text) print(new...
Yoriz General Coding Help 3 378 Jan-13-2024, 11:21 AM
    Thread: Variable definitions inside loop / could be better?
Post: RE: Variable definitions inside loop / could be be...

The example code does not have a loop so it does not show the problem you are having doubts about.
Yoriz General Coding Help 2 364 Jan-09-2024, 10:51 PM
    Thread: [pandas] TypeError: list indices must be integers or slices, not str but type is int.
Post: RE: [pandas] TypeError: list indices must be integ...

In the line exercises = df.loc[ix_mg[0][1]].at[m_g[ix_mg[0][0]]]Look at this part m_g[ix_mg[0][0]]Not used pandas in a while is that a valid input for at? Looking at https://pandas.pydata.org/docs/re...
Yoriz Data Science 4 711 Dec-29-2023, 10:19 PM
    Thread: I'm looking for the syntax of a complex exponent, like: 2 ** (n - m)
Post: RE: I'm looking for the syntax of a complex expone...

The walrus := could be used to only compute n - m only once. import itertools n = 3 m = 1 p = n - m numbers = ( (98**p) + (2**p), (98 ** (n - m)) + (2 ** (n - m)), (98 ** (result := n - m...
Yoriz General Coding Help 2 464 Dec-29-2023, 01:53 PM
    Thread: Strange behavior of parse_qsl when parameter value is '+'
Post: RE: Strange behavior of parse_qsl when parameter v...

The end of the parse_qsl function is using replace('+', ' ') def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, sep...
Yoriz Web Scraping & Web Development 2 683 Dec-28-2023, 11:10 AM
    Thread: error occuring in definition a class
Post: RE: error occuring in definition a class

https://docs.python.org/3/reference/data...ct.__new__ Wrote:object.__new__(cls[, ...]) Called to create a new instance of class cls. __new__() is a static method (special-cased so you need not declare...
Yoriz General Coding Help 3 600 Nov-26-2023, 09:28 AM
    Thread: error occuring in definition a class
Post: RE: error occuring in definition a class

As per the error TypeError: object.__new__() takes exactly one argument (the type to instantiate) Change obj = super().__new__(cls, *args, **kwargs)to only pass cls obj = super().__new__(cls)
Yoriz General Coding Help 3 600 Nov-25-2023, 02:01 PM
    Thread: Help needed for a program using loops
Post: RE: Help needed for a program using loops

Well done, you will still be getting a blank line printed as the range will return 0, 1, 2, 3, 4. Changing the range to have a start value of 1 will skip the o giving 1, 2, 3, 4. for x in range(1, 5):...
Yoriz Homework 5 1,246 Sep-03-2023, 01:54 PM
    Thread: Help needed for a program using loops
Post: RE: Help needed for a program using loops

A range of 1 will only loop once with a value of 0. 0*"*" won't print anything n = n+1 does nothing to alter your print statement as it is only using x range can have its first parameter as the start ...
Yoriz Homework 5 1,246 Sep-03-2023, 12:50 PM
    Thread: [NEW CODER] TypeError: Object is not callable
Post: RE: [NEW CODER] TypeError: Object is not callable

I am not sure what is going on, the code you have shown doesn't look like it would give the error shown. The error states that you are calling a str object, but I cant see that you are. Edit: The cod...
Yoriz General Coding Help 5 1,226 Aug-20-2023, 11:34 AM
    Thread: problem in using pyqrcode module to create QRcode
Post: RE: problem in using pyqrcode module to create QRc...

https://pypi.org/project/PyQRCode/ Wrote:Requirements The pyqrcode module only requires Python 2.6, Python 2.7, or Python 3. You may want to install pypng in order to render PNG files, but it is optio...
Yoriz General Coding Help 9 1,727 Aug-19-2023, 03:12 PM
    Thread: return next item each time a function is executed
Post: RE: return next item each time a function is execu...

Maybe you are asking to get the next value each time the code is run not the function is called. Each time the code is run it will return to its beginning state. To alter the state of which item is se...
Yoriz General Coding Help 19 2,115 Aug-06-2023, 08:35 AM
    Thread: restrict user input to numerical values
Post: RE: restrict user input to numerical values

Maybe you could use the strings isdigit method if digit != 4 or not year.isdigit():
Yoriz General Coding Help 2 858 Apr-08-2023, 05:00 PM
    Thread: Can we use Python 4's end keyword in Python 2.7?
Post: RE: Can we use Python 4's end keyword in Python 2....

Only usable on April the 1st.
Yoriz General Coding Help 4 931 Apr-01-2023, 01:50 PM
    Thread: method call help
Post: RE: method call help

Google translation Good morning, I get a result not which I expect, and I don't know why? when I call the pricing_mac(self): method of class HardwareGeek(EmployeeHardware): the price does not change,...
Yoriz General Coding Help 6 1,061 Feb-19-2023, 03:39 PM
    Thread: Pandas AttributeError: 'DataFrame' object has no attribute 'concat'
Post: RE: I need help !!!!

The error line 24 df_total = df_total.concat(df)does not match your posted code line 24 df = excel_file.parse(sheet_name = sheet)neither does the next line df_total = df_total.append(df)DataFrame does...
Yoriz General Coding Help 5 5,187 Feb-17-2023, 03:35 PM

User Panel Messages

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