Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: re.sub not working
Post: RE: re.sub not working

Hello, (Oct-02-2022, 04:50 AM)deanhystad Wrote: Some characters have special meanings in regular expressions, such as (). You obviously know this because your used backslashes to remove their spec...
Coricoco_fr General Coding Help 7 690 Oct-02-2022, 05:42 AM
    Thread: Python 100 line Challenge
Post: RE: Python 100 line Challenge

(Jun-04-2022, 10:25 AM)menator01 Wrote: Here is my go at it using after. import tkinter as tk import time class View: def __init__(self, parent): self.parent = parent self.canv...
Coricoco_fr Code sharing 9 1,601 Jun-20-2022, 07:18 AM
    Thread: How to find the second lowest element in the list?
Post: RE: How to find the second lowest element in the l...

Hello, >>> students = [['Harry', 37.21], ['Berry', 37.21], ['Tina', 37.2], ['Akriti', 41], ['Harsh', 39]] >>> studList = [student[0] for student in sorted(students, key = lambda x: x...
Coricoco_fr General Coding Help 3 663 May-31-2022, 01:58 PM
    Thread: Python 100 line Challenge
Post: RE: Python 100 line Challenge

(May-27-2022, 02:19 PM)codingCat Wrote: Here is a first offering. Something I have dubbed a chaos spinner. Credit for the trig needed to rotate the spinners goes to its original author. My contribu...
Coricoco_fr Code sharing 9 1,601 May-29-2022, 06:06 PM
    Thread: Python 25 Line Challenge
Post: RE: Python 25 Line Challenge

(May-09-2022, 06:33 PM)codingCat Wrote: (May-09-2022, 06:04 PM)menator01 Wrote: If you remove comments and spacing, got it to 31 lines. hideturtle(), speed('fastest') penup(), goto(-200, 10*30/2),...
Coricoco_fr Code sharing 34 4,169 May-11-2022, 05:34 PM
    Thread: check if element is in a list in a dictionary value
Post: RE: check if element is in a list in a dictionary ...

Hello, (May-11-2022, 04:18 PM)ambrozote Wrote: something like this?You can use for/else loop: a = "Doors" dict = {"a":["Doors","Windows"],"b":"Stairs"} for val in dict.values(): if a in val: ...
Coricoco_fr General Coding Help 4 991 May-11-2022, 05:21 PM
    Thread: Python 25 Line Challenge
Post: RE: Python 25 Line Challenge

(May-09-2022, 12:17 PM)codingCat Wrote: And here is another offering of my own -- I took the random maze idea from youTube's 8-bit guy and combined it with a random maze idea of my own. I had to do ...
Coricoco_fr Code sharing 34 4,169 May-09-2022, 01:11 PM
    Thread: Split a number to list and list sum must be number
Post: RE: Split a number to list and list sum must be nu...

(Apr-27-2022, 12:16 PM)Dexty Wrote: (Apr-27-2022, 05:10 AM)sunny9495 Wrote: How to split a number to list and list sum must be number Example : x = 8 i want to split and make a list with 3 items...
Coricoco_fr General Coding Help 5 1,100 Apr-28-2022, 06:47 AM
    Thread: How do I remove spurious "." from a string?
Post: RE: How do I remove spurious "." from a string?

Hello, you can do this: >>> text = 'I a.m so pl.ea.sed to me.et y.ou. I ho.pe .tha.t th.is is t.he st.a.rt of a lo.n.g fri.en.dsh.ip.' >>> ". ".join(sentence.replace(".", "") for se...
Coricoco_fr General Coding Help 7 977 Apr-12-2022, 04:20 AM
    Thread: list, map and put of the Queue in the Tree Data Structure
Post: RE: list, map and put of the Queue in the Tree Dat...

Hello, This for explain: class Example(): def __init__(self): pass def mymethod(self, name): return f"Hello {name}" ex = Example() out = list(map(ex.mymethod, ['me', 'you'])) p...
Coricoco_fr Homework 6 1,002 Mar-30-2022, 03:52 AM
    Thread: Typeerror
Post: RE: Typeerror

Hello, Please show the Traceback. It contains useful information.
Coricoco_fr Homework 2 811 Mar-28-2022, 06:24 AM
    Thread: Return a value to __main__
Post: RE: Return a value to __main__

This is a better practice. import tkinter as tk class Window(tk.Frame): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.count = 1 self.label =...
Coricoco_fr GUI 7 1,033 Mar-27-2022, 07:52 AM
    Thread: Return a value to __main__
Post: RE: Return a value to __main__

Hello, I'm not sure I understood your request. Do you want to do this? : import tkinter as tk class Window(tk.Tk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ...
Coricoco_fr GUI 7 1,033 Mar-27-2022, 06:54 AM
    Thread: name.split() + (And) + print question
Post: RE: name.split() + (And) + print question

for display: >>> out = ["Bob", "Alice"] >>> print(f"Hello {' and '.join(out) if out else 'stranger'}") Hello Bob and Alice >>> out.pop() 'Alice' >>> print(f"Hello {...
Coricoco_fr Homework 12 1,876 Mar-26-2022, 03:28 PM
    Thread: name.split() + (And) + print question
Post: RE: name.split() + (And) + print question

Quote:Also what is to meaning to have input(">") rather then input() It's all the same. It's just to display ">".
Coricoco_fr Homework 12 1,876 Mar-26-2022, 02:43 PM
    Thread: name.split() + (And) + print question
Post: RE: name.split() + (And) + print question

Hello, I propose this: entry = input(">").split() d = {"A": False, "B": False, "C": False} for word in entry: if 'A' == word: d['A'] = True if 'B' == word: d['B'] = True ...
Coricoco_fr Homework 12 1,876 Mar-26-2022, 02:15 PM
    Thread: name.split() + (And) + print question
Post: RE: name.split() + (And) + print question

Hello, @deanhystad: What do you have in mind? Show it. If for you the difference is the difference between words and name is the capitalization it is not a valid criterion ...
Coricoco_fr Homework 12 1,876 Mar-26-2022, 05:10 AM
    Thread: name.split() + (And) + print question
Post: RE: name.split() + (And) + print question

Hello, name = input() if 'Alice' in name: if 'Bob' in name: print ('Hello Bob & Alice!') else: print ('Hello Alice!') elif 'Bob' in name: print ('Hello Bob!')
Coricoco_fr Homework 12 1,876 Mar-25-2022, 03:11 PM
    Thread: Unpacking zip object
Post: RE: Unpacking zip object

Hello, Sorry
Coricoco_fr General Coding Help 12 1,533 Mar-24-2022, 07:51 PM
    Thread: Function combining file manipulation and loop
Post: RE: Function combining file manipulation and loop

Hello, You have to call the function with the name of the file as parameter. wordlst = ['car', 'cat', 'dog'] write_list_to_file(wordlst, "filename.txt")and modify your code like this: def write_list_t...
Coricoco_fr Homework 5 1,036 Mar-23-2022, 05:05 AM

User Panel Messages

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