Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: field in db as text
Post: RE: field in db as text

(Jul-15-2021, 01:38 PM)rwahdan Wrote: (Jul-15-2021, 11:40 AM)deanhystad Wrote: Really? You are asking how to get an item from a tuple?No I am getting the value from database and its data type is ...
GOTO10 GUI 6 456 Jul-15-2021, 01:53 PM
    Thread: field in db as text
Post: RE: field in db as text

As long as your are certain the format of your data will be consistent, you could use * to unpack the iterable and get the output you are looking for: x=('A. 2',) print(x) print(*x)Output:('A. 2',) A....
GOTO10 GUI 6 456 Jul-15-2021, 11:40 AM
    Thread: Starting first code
Post: RE: Starting first code

(May-11-2021, 03:12 PM)Ricky Wrote: I've no idea what you're asking mate. You have written some Python code and it is not doing what you expect. Show us the code so we can help.
GOTO10 General Coding Help 4 578 May-11-2021, 03:13 PM
    Thread: Starting first code
Post: RE: Starting first code

(May-11-2021, 12:56 PM)Ricky Wrote: Hi, I've downloaded and been through the topics. I've now typed - once I opened EDLE. print ("Hisssssss...") Saved As then OPEN the file and clicked run RUN - MO...
GOTO10 General Coding Help 4 578 May-11-2021, 03:07 PM
    Thread: Python isdigit() and None
Post: RE: Python isdigit() and None

In circumstances like this where the value may be None (or an empty string, list, etc.), one option is to use and to make sure there is a value before trying isdigit(). So, instead of:if presets.get(...
GOTO10 General Coding Help 6 1,073 May-06-2021, 02:04 PM
    Thread: help needed for a friend! :)
Post: RE: help needed for a friend! :)

(May-05-2021, 08:27 PM)Powell123 Wrote: BashBedlam - can you tell me if you have run the code and if so how far in the game did you get! are the errors making the game not run! ? The game can't be p...
GOTO10 Homework 13 1,244 May-06-2021, 12:24 PM
    Thread: How to multiply tuple values in array?
Post: RE: How to multiply tuple values in array?

If you are literally just looking to get from [(x1, y1),(x2, y2)] to [(x1 * y1), (x2 * y2)], you can do it like this since you know each tuple will have two values: x=[(1, 3), (2,4)] new=[] for pair...
GOTO10 Homework 3 791 Apr-29-2021, 06:05 PM
    Thread: Unexpected behavior accessing list elements.
Post: RE: Unexpected behavior accessing list elements.

Your assignment statement for b is creating three references to the same list, where a is three distinct lists. Consequently, b[0], b[1], and b[2] are all pointing to the same list object. a = [[0,0...
GOTO10 Homework 2 583 Apr-09-2021, 12:53 PM
    Thread: Recursion and permutations: print all permutations filling a list of length N
Post: RE: Recursion and permutations: print all permutat...

(Apr-09-2021, 06:48 AM)SantiagoPB Wrote: I found the solution!!! CODE WORKING def stringPermutations(string, prefix, permutation_list): if len(string) == 0: permutation_list.append(prefi...
GOTO10 Homework 6 881 Apr-09-2021, 12:36 PM
    Thread: Recursion and permutations: print all permutations filling a list of length N
Post: RE: Recursion and permutations: print all permutat...

(Apr-08-2021, 09:17 PM)SantiagoPB Wrote: I am trying to give the length of the list using n variable I guess what I mean is, "Why did you think this would work?" Writing the recursive function requ...
GOTO10 Homework 6 881 Apr-08-2021, 09:47 PM
    Thread: Recursion and permutations: print all permutations filling a list of length N
Post: RE: Recursion and permutations: print all permutat...

Your line 12 isn't accomplishing anything. What are you trying to do there? single_list = [] multiplied_list = [] * 10 print(f'Single: {single_list}') print(f'Multiplied: {multiplied_list}')Output:S...
GOTO10 Homework 6 881 Apr-08-2021, 08:28 PM
    Thread: How to create a simple GUI
Post: RE: How to create a simple GUI

There are many options, but Tkinter would probably be a good place to start for a simple GUI. See documentation here.
GOTO10 GUI 7 878 Mar-25-2021, 02:41 PM
    Thread: Stranger in our midst
Post: RE: Stranger in our midst

Using a while loop is the right idea. There are many ways to approach this. I personally prefer using a break to exit the loop when the stop condition is satisfied. words = [] while True: new_...
GOTO10 Homework 3 603 Mar-22-2021, 11:40 AM
    Thread: Problem restricting user input in my rock paper scissors game
Post: RE: Problem restricting user input in my rock pape...

(Mar-19-2021, 10:58 AM)ashergreen Wrote: It works! But I have one question: When I programmed in C many years ago, the "user1 != "rock"...." line worked perfectly and also worked when I played wit...
GOTO10 General Coding Help 6 1,102 Mar-19-2021, 11:14 AM
    Thread: Simple problem with functions and returns
Post: RE: Simple problem with functions and returns

On line 30, when you call started(menu) without parentheses after menu, you are passing in the function itself rather than its return value. To pass the value that is returned by the function, you ne...
GOTO10 Homework 10 1,552 Mar-17-2021, 03:45 PM
    Thread: Simple problem with functions and returns
Post: RE: Simple problem with functions and returns

I see what you are saying. The instructions say that your menu function should return an integer, but they also imply that the argument you pass to the started function should be a string. That does...
GOTO10 Homework 10 1,552 Mar-17-2021, 12:32 PM
    Thread: Simple problem with functions and returns
Post: RE: Simple problem with functions and returns

I'm not sure I understand your question at this point. The value returned by menu() is an integer (if input is valid), so that is what is being passed to started(). Assuming the user inputs a "1" wh...
GOTO10 Homework 10 1,552 Mar-17-2021, 12:00 PM
    Thread: Simple problem with functions and returns
Post: RE: Simple problem with functions and returns

It will be easier to read your code on this forum if you use /python tags as described here: BBCode Your function menu() is going to return either an integer value or None if the input is invalid. Y...
GOTO10 Homework 10 1,552 Mar-17-2021, 11:35 AM
    Thread: Searching for parts of a string or word
Post: RE: Searching for parts of a string or word

(Mar-14-2021, 05:14 PM)Ulumulu Wrote: My code should react to my input. The input is compared to string1. If there are some similaritys, it should give me "Word found". What does "some similarities"...
GOTO10 Homework 8 1,033 Mar-14-2021, 08:40 PM
    Thread: Searching for parts of a string or word
Post: RE: Searching for parts of a string or word

Your code as currently written is looking at the list variable string1, which you have explicitly defined, to see if it contains either text or word. So, you are only going to get the "Word found" ou...
GOTO10 Homework 8 1,033 Mar-14-2021, 03:15 PM

User Panel Messages

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