Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Input function
Post: RE: Input function

The function you shared (without formatting) is incomplete. def mytriangle (base, height): print ("The base is ", base) print ("The height is ", height) base (10) height (15) myar...
gruntfutuk Homework 10 735 Jan-09-2021, 11:36 AM
    Thread: installing openpyxl
Post: RE: installing openpyxl

You have a choice of any package being installed in the default directory, or creating a Python virtual environment using the venv command. The latter option is generally preferred to avoid polluting ...
gruntfutuk General Coding Help 2 2,769 Jan-28-2020, 01:24 PM
    Thread: f-string-ify
Post: RE: f-string-ify

(Jan-25-2020, 07:28 PM)Skaperen Wrote: my requirement is very simple. i need to just do what an f-string does, but getting the contents between the quotes from somewhere else besides the source cod...
gruntfutuk News and Discussions 10 2,133 Jan-26-2020, 10:54 AM
    Thread: f-string-ify
Post: RE: f-string-ify

Yes, but just to illustrate. I am sure you recognise the foo and bar references in the template definition are not related to the foo and bar used later. The substitution could have been in-situ and l...
gruntfutuk News and Discussions 10 2,133 Jan-25-2020, 12:03 PM
    Thread: f-string-ify
Post: RE: f-string-ify

Look again.
gruntfutuk News and Discussions 10 2,133 Jan-24-2020, 06:08 PM
    Thread: f-string-ify
Post: RE: f-string-ify

Not tried it, but I wonder if you could use string Template, from string import Template to handle the patterns. Just tried a crude example, apologies if missing the plot here: from string import Te...
gruntfutuk News and Discussions 10 2,133 Jan-22-2020, 05:44 PM
    Thread: App for excel sheet analysis
Post: RE: App for excel sheet analysis

(Jan-20-2020, 04:27 PM)Larz60+ Wrote: You can certainly use openpyxl, but if you are willing to spend a bit of time learning, I would suggest that Pandas is the way to go. Package overview: https://...
gruntfutuk Homework 6 823 Jan-20-2020, 06:33 PM
    Thread: Rename file from value in text file
Post: RE: Rename file from value in text file

So where exactly are you stuck? Use pathlib to handle the filenames, loop through the list of employee names and for each name, rename the file to the corresponding new filename. Use try/except block...
gruntfutuk General Coding Help 1 759 Jan-20-2020, 03:50 PM
    Thread: f-string-ify
Post: RE: f-string-ify

Care to share an example of the code?
gruntfutuk News and Discussions 10 2,133 Jan-20-2020, 03:45 PM
    Thread: App for excel sheet analysis
Post: RE: App for excel sheet analysis

Look at examples for using the openpyxl library. Here's some code showing a simple example I shared on the learnpython subreddit a little while back. import openpyxl from openpyxl import Workbook fro...
gruntfutuk Homework 6 823 Jan-20-2020, 03:29 PM
    Thread: Phone app from python code
Post: RE: Phone app from python code

Take a look at kivy if you want something that looks like a native app. Also, consider turning your work into a webapp.
gruntfutuk General Coding Help 1 834 Mar-29-2019, 05:16 PM
    Thread: Testing an API
Post: RE: Testing an API

You are going to have to help us to help you, like sharing some code maybe.
gruntfutuk General Coding Help 1 738 Mar-29-2019, 05:10 PM
    Thread: Python only outputting "101"
Post: RE: Python only outputting "101"

Your code is fine, so something must be wrong with your environment. Are you using an IDE like PyCharm? Are you sure you are executing the correct code (run does not necessarily execute the code you ...
gruntfutuk General Coding Help 4 2,251 Jan-08-2019, 08:05 PM
    Thread: beginning python help request (for loop)
Post: RE: beginning python help request (for loop)

In Python, variable names point to objects somewhere in memory. Objects are things like integers, strings, lists, and so on. So, result = 1 means result refers to the object somewhere in memory that i...
gruntfutuk Homework 3 1,129 Oct-26-2018, 07:20 PM
    Thread: convert words to nums and vica versa
Post: RE: convert words to nums and vica versa

Don't try to write Python. Not at first. Instead, work out how you would do this yourself if you had to do it in very very basic steps where you can only do one thing at a time, and have very poor me...
gruntfutuk Homework 5 1,267 Oct-26-2018, 07:05 PM
    Thread: Print The Length Of The Longest Run in a User Input List
Post: RE: Print The Length Of The Longest Run in a User ...

It would be better if you posted your code on this forum rather than in a link. I have looked at your code. Please rewrite and use meaningful variable names. It is very hard to follow your intentions...
gruntfutuk Homework 3 1,430 Oct-26-2018, 06:56 PM
    Thread: Login and register code
Post: RE: Login and register code

Firstly, here's your definition of ref with a minor correct to the text your write to file (you mistyped Password): def reg(): uname = input("Please enter a username: ") pword = input("Please...
gruntfutuk Homework 1 1,023 Oct-13-2018, 07:48 PM
    Thread: .remove() method in for-loop
Post: RE: .remove() method in for-loop

You can avoid a lot of problems when removing items from a list if you traverse it in reverse: sw = ['bo', 'go', 'bo', 'do', 'bo', 'we', 'bo', 'bo'] for cm in sw[::-1]: if cm == "bo": sw....
gruntfutuk Homework 7 1,833 Oct-13-2018, 07:05 PM
    Thread: #python .... Need to develop a if condition from two lists
Post: RE: #python .... Need to develop a if condition fr...

You might want to look at the zip() function.
gruntfutuk Homework 2 1,227 Oct-05-2018, 12:45 PM
    Thread: Multiplicate several numbers
Post: RE: Multiplicate several numbers

(Oct-05-2018, 08:40 AM)Student0 Wrote: Thanks for answer, but it didnt work :/ Do you have other suggestions? :) [Image: https://imgur.com/a/kCqm92f]Well, the code by nilamo: import functools impor...
gruntfutuk General Coding Help 5 1,130 Oct-05-2018, 09:41 AM

User Panel Messages

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