« first day (1006 days earlier)      last day (2372 days later) » 

2:23 AM
Hey, has anyone got a minute to help me?
Hey, Savannah could you possibly help me?
 
2 messages moved from Python
 
for m in k:
if m <0: raise Exception("positive number "+m)
if m == 0: return '0'
ret = ""
while m !=0:
ret = (basedigits[m%BASE])+ret
m = int(m/BASE)
shortcode = ret
final_short_url = str(shortcode)
TypeError: not all arguments converted during string formatting
 
2 messages moved from Python
 
2:43 AM
line 40, in shorturl
ret = (basedigits[m%BASE])+ret
TypeError: not all arguments converted during string formatting
 
6 mins ago, by davidism
> m is a string
 
I don't know how to fix that, what should it be.
 
Based on the code you wrote, what do you think it should be?
 
I'm trying to convert someone else's code, so I understand what it's doing. So I don't know.
 
It should be an int. You never showed what k is, but it's either a string or an iterable containing strings. You It looks like you want to do a mod operation. You never showed BASE, but I assume it's an int.
 
2:45 AM
Most likely should be an int
basedigits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
BASE = len(basedigits)
 
@Calvin-Castle unfortunately, chat is not a good place for slowly getting you to tell us an actual MCVE.
Nov 12 at 19:39, by davidism
We requrire you to have a basic understanding of Python, your problem, and your data, before we can help you. That's for our sanity and your long-term benefit.
Start by thinking through what you're trying to do. Use a debugger to explore your code and data.
 
@davidism Guess I'll move on, I have no clue how to fix this. I thought this site was meant to help people. You clearly understand what my problem is...
 
I've spent over a page of chat and we haven't got anywhere. We are happy to help users who meet the requirements described in that quote, for the reason stated.
 
I don't even know how to respond to that, what else do you need to know. You legit have all the info.
 
You don't respond to it. You sit down, knowing what you've been told about ints and strings now, and start exploring your code and data to start understanding your problem.
You haven't actually described what you're trying to accomplish or what your data is, so it's not surprising that I can't answer you any more specifically. This isn't a prompt to add more information here though, do what I said above.
16 messages moved from Python
 
 
2 hours later…
4:58 AM
@davidism You're a bit too trigger happy when it comes to kicking people out
 
No, I'm not. We're not having this conversation yet again.
2 messages moved from Python
 

« first day (1006 days earlier)      last day (2372 days later) »