I have list of this sort. It is the order list of a person: How do I extract the string and the float value separately? I need to calculate the total order cost based on the given fruit prices: This is what I have tried: This yields wrong answer. What am I doing wrong? How can I fix this? Thanks!
Tag: logic
Python script to extract data from csv file
sharing the sample file screenshots, script I developed and other details below. In the countries_source.csv file, I have a list of countries and I need a subset of its data created in mycountries.csv file until I hit the value “Asia” in the first column. Using the below script, I was able to get the data till the 14th row –
using pop on multidimensional lists python with dynamoDB
I want to pop an item from a list of lists. So I have a scan for all dynamo Items and want to “pop” one field from each list. For example: The List: From this example, I have a bunch of Results and for every result list, I will remove the Item “credentials” like However, this isn’t working Answer You’re
How to optimise function logic to avoid duplication – python
I have some code below, for a given name that matches pattern with 2 lower case letters (such as ‘aa’), the valid name can be V-aa or X-aa My question is: can I do something like: Answer From your description, I assume that verify_helper() is computationally expensive regardless of names being valid. Now you want to optimize the code, by
Iterating through records with SQL INSERT activated stops after first set of INSERTS, but using PRINT to test goes through EVERY record (as desired)
Python 3.10.2 with sqlite3 on Windows 10. Relatively new to Python, but I was quite experienced with Perl around 1997-2005. Banged my head against this for three days. Attacked from lots of angles. No success. I’m asking for guidance, because I don’t see myself progressing on my own at this point without help flipping on the light-switch. My overall application
How to find maximum group size dynamically
I want to find the maximum group size g_new if I want to partition a list of ‘n’ values. We can have any number of groups. I have: n values and maximum group size possible g_max. e.g. n = 110 and g_max = 25. We cannot form groups of size: [28,28,27,27] as no group should be more than 25! Here,
How can you find which checkbutton is selected using Tkinter and a function?
Here I am trying to create a list of three fruits , Apple ,Pomegranate and Banana, and asking the user to select their favorite fruit. So I am defining a function print_choice that is called each time any checkbox is selected , and have defined an array fruits that appends the respective fruit to the array when the checkbox is
Python: Maximum Subarray Sum
I’ve just tried to start learning Python today, so I am not knowledgeable when it comes to it’s functions. However, I found the maximum subarray problem, and wanted to try and solve it with the few, simple logical commands I have at my disposal. I have gotten stuck, and am almost certain the problem is in my logic and not