153 Posted Topics

Member Avatar for hladdha.bhl2009

hit the (CODE) button/tags before you post code, also your strategy for the key is awful...I don't understand why you would do:d=len(phbuk);phbuk[d+1]=name How about something more like: `phbuk[a]=abc #"or [b,c] depending on your preference"#` > Now if i want to delete a particular record just by giving name then how …

Member Avatar for JoshuaBurleson
0
257
Member Avatar for Tyler212

Here's a little help to get the juices flowing, but for the future you need to show effort around here [B][U]take heed of Ezzaral's edit notes[/U][/B] and read that thread, or for a quicker review of what he's talking about read [U][URL="http://www.daniweb.com/software-development/python/threads/359823"]pytony's signature[/URL][/U][CODE]def mult_table_numbers(): alpha = int(input('Starting: ')) omega = …

Member Avatar for ScottieF
0
2K
Member Avatar for asong

You can't just drop off your homework assignment and expect us to do it for you, put some effort in and we'll help you figure out issues.

Member Avatar for TrustyTony
-1
425
Member Avatar for Tcll

Tcll, as you should know people are much less likely to reply to "solved" threads, we also don't like old ones bumped up, just start a new thread.

Member Avatar for JoshuaBurleson
0
2K
Member Avatar for Dane2259

Python comes with an IDE called IDLE; I'd suggest reading the beginner threads and also decide which version of python you're going to start with, python 3.2.2 is the most recent version, there are more packages available for python 2.7 but the future is python 3; python 3 is backwards-incompatible …

Member Avatar for JoshuaBurleson
0
126
Member Avatar for bigredaltoid

You were thinking in the right direction, you just weren't actually doing anything: I'll give you heavy help on one of them and the idea should become quite clear for all of them. [CODE]>>> word=input('word: ') word: hello >>> word3='' >>> for letter in word[::-1]: #which could also be "for …

Member Avatar for TrustyTony
0
405
Member Avatar for M.S.

:) well just so ya know there is a random module with things like shuffle.[CODE]import random f=open('names.txt','r') names=f.readlines() f.close() selected_names=set() while len(selected_names)<5: random.shuffle(names) indx=random.randint(0,len(names)-1) selected_names.add(names[indx])[/CODE] a set will get rid of any duplicates. but you could also do a "if key not in list" kind of thing:[CODE]selected_names=[] while len(selected_names)<5: random.shuffle(names) …

Member Avatar for M.S.
0
6K
Member Avatar for JoshuaBurleson

Just fooling around I came across an issue updating a digital-clock like label. This: [CODE]self.now=time.strftime('%a. %b %d %Y %H:%M:%S',time.localtime()) self.clock=ttk.Label(self,text=self.now) self.clock.pack() while True: self.now=time.strftime('%a. %b %d %Y %H:%M:%S',time.localtime()) self.clock['text']=self.now[/CODE] simply freezes the program, I've managed to get it to update on certain events like the user hitting a button but …

Member Avatar for JoshuaBurleson
0
217
Member Avatar for jagan605
Member Avatar for Cupidvogel

here's an interesting article on the subject "I didn't even know about CubicWeb before it" [URL="http://www.itworld.com/software/192113/pillars-python-six-python-web-frameworks-compared"]http://www.itworld.com/software/192113/pillars-python-six-python-web-frameworks-compared[/URL]

Member Avatar for Cupidvogel
0
213
Member Avatar for WASDted

<DANIWEB> /es /. to pieces or for pythonistas [code=Python]while true: print('<DaniWeb> rocks') >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks[/CODE] and it has to show in the code format of course. ...

Member Avatar for Netcode
0
989
Member Avatar for paraclete

Instead of 1 or 0 why don't you return True or False...? Also, even though it's a bad habit of mine, it's considered ugly to use globals when not necessary in a function, you could simply return what you need to, try putting all these things in an array or …

Member Avatar for paraclete
0
227
Member Avatar for pythonhelp11
Member Avatar for d3fined

It was easier for me with a function, also if you want to get the correct index value remember that python counts the first as 0, so how do you think you should accommodate for that d3fined?

Member Avatar for TrustyTony
0
182
Member Avatar for aabi

I'm confused, so you want to create a free web service that does something that people need done, and you DO or DON'T want it to be surveys? Sorry for the confusion.

Member Avatar for chrishea
-1
90
Member Avatar for computerchip

I would abstract the date box into a function and use string formatting to insert the words date and whatever date is, maybe I'm misunderstanding the problem, but I'd do something like:[CODE]def make_label(word): try: lab='| %s: |\n+-------------------+' % word return lab except TypeError: lab='' for words in word: slab='| %s: …

Member Avatar for TrustyTony
0
189
Member Avatar for aj9393

wrong type, watch this magic:[CODE]>>> a=input('code: ') code: 3 >>> a==3 False >>> a '3' >>> print(3) 3 >>> type(a) <class 'str'> >>> type(3) <class 'int'> >>> a=int(a) >>> a==3 True[/CODE] input creates a string, if you want it to be an integer you need to be explicit about it.

Member Avatar for JoshuaBurleson
0
119
Member Avatar for JoshuaBurleson

Does anybody know a good working Python 3.x wrapper for OAUTH2? I'm having issues with the backwards incompatability with simplegeo-python-oauth2.:'(

Member Avatar for TrustyTony
0
136
Member Avatar for jainpratik2

This doesn't belong in code snippets as it is a question, hopefully a mod will fix that soon. Python comments are preceded by # or are within ''' ''' also your indentation is way off. Also, given this code how do you intend the "ATM" to know the customers password? …

Member Avatar for jainpratik2
0
178
Member Avatar for JoshuaBurleson

Early this morning, and I haven't a clue how this slipped by me, I learned about the Android SDK and Python for Android, I did a little research, it's very intriguing. Has anybody worked with this at all? Do most built in libraries and modules work for it? How do …

Member Avatar for JoshuaBurleson
0
364
Member Avatar for crazygamer49

Do you think we just do your homework for you? Do what you can and show us some effort and ask specific questions. Effort in, effort out.

Member Avatar for TrustyTony
0
94
Member Avatar for oberlin1988

[QUOTE]Of course, this ends after the first two draws. The total is a randint (1,10). I guess I don't actually understand what str(sum(total)) does.[/QUOTE] Alright, you're putting in some effort so I'll help you step-by-step as long as you continue the effort. First I'll start with that last part str(sum(total)) …

Member Avatar for JoshuaBurleson
0
264
Member Avatar for JoshuaBurleson

I'm having an issue getting python 3.2 to recognize files in ubuntu, it's the first time I've tried to code while running it. A specific example of the issue is when setting an .ico to be a bitmap logo for a Frame in tkinter it's claiming that there it's not …

Member Avatar for woooee
0
673
Member Avatar for arindam31
Member Avatar for arindam31
0
244
Member Avatar for Tyler212

[QUOTE=paxton91;1656731]You are not appending the list anywhere. Computer see's list as nothing See's someone needs to input something See's something being printed See's that for every interation it will print a list of nothing And then see's more user input[/QUOTE] and likewise:[CODE]>>>r=[] >>> r.extend((input('Three Things: ').split())) Three Things: my uncle …

Member Avatar for JoshuaBurleson
-1
211
Member Avatar for Danielle87

well I'm not so sure that regex would be necessary for this if it's just a couple words.[CODE]def find_these_words(text): if 'I' in text: print('found I') if 'love' in text: print('found love') >>> t=input('Text>>> ') Text>>> Ilovepython >>> find_these_words(t) found I found love >>>t=input('Text>>> ') Text>>>I love daniweb >>>find_these_words(t) found I …

Member Avatar for JoshuaBurleson
0
95
Member Avatar for JoshuaBurleson

Hello mates, I was wondering if in that vast amount of knowledge floating around here if any of you knew how I could save an image using Python 3.x. I know that PIL is a great, and easy option for Python 2, but I assume there must be some way …

Member Avatar for JoshuaBurleson
0
588
Member Avatar for Gustavo_B

your command for that button is going to cause issues, I've noticed whenever you have command=method_or_function(parameter) it immediately attempts to run that command, I've side stepped this by creating methods that know to grab that parameter.I'm not completely sure about the rest of the issue, I'd need to see more …

Member Avatar for JoshuaBurleson
0
1K
Member Avatar for ericoscarj

here I'll give you an example of how you should show us your pseudo code, let's say I'm trying to count the number of words in a list that have the letter b in them:[CODE]I need a parameter or input I need a count I need the count to go …

Member Avatar for Enalicho
0
111
Member Avatar for tzho11
Member Avatar for JoshuaBurleson
0
154
Member Avatar for huntin4hitters

well first of all you need to think out how it should work. So, mathematically how do you find the divisors of a number? Then how would you say that in Python? Effort in effort out around here.

Member Avatar for TrustyTony
0
120
Member Avatar for Jburton881
Member Avatar for JoshuaBurleson
0
169
Member Avatar for M09
Member Avatar for JoshuaBurleson
0
390
Member Avatar for WhooeyBob
Member Avatar for JoshuaBurleson

I just had to get this one out there. I love daniweb, and I'm sure the [B]VAST[/B] majority of the users here do as well. And, unlike many other websites this one's community is made up of some of the greatest IT and Development minds around "as well as noobs …

Member Avatar for Dani
1
339
Member Avatar for syjytg

come on now, obviously you have to assign the variable to a value...[CODE]>>> s=10 >>> >>> int(s) 10 >>> print(s) 10 >>> s+3 13[/CODE] but that only answers part of it, first you have to assign s to a string value, HINT: this is done by surrounding the value with …

Member Avatar for syjytg
0
744
Member Avatar for arson09

well, from what I'm seeing it looks like it'll come up surrounded by brackets then curly braces.[CODE][{'my','set'}][/CODE] because you made the set a list of the set, and I'm asking myself why you found that necessary... also, work on your names i is not a good name, I looked at …

Member Avatar for arson09
0
250
Member Avatar for The Bl

If you want it to continue, regardless of under what circumstance, you need to create a loop.

Member Avatar for TrustyTony
0
339
Member Avatar for asa88

Because you've appended a pointer to that list, so when b changes the pointer sees the change. However if you make a COPY it has its own list. Consider the following interactive experiment: [CODE]>>> f=['bob','jack'] >>> d=['bill'] >>> d.append(f) >>> d ['bill', ['bob', 'jack']] >>> f.pop() 'jack' >>> f ['bob'] …

Member Avatar for Enalicho
0
12K
Member Avatar for Skrell

[QUOTE=Gribouillis;1650305]The method sort() sorts the list in place and returns None [code=python] >>> list1 = ['Herring','used','to','be','abundant','in','the','AtlAntic','Ocean','then','herring','got','overfished'] >>> list1.sort(key=lambda s : s.count('a')) >>> print list1 ['Herring', 'used', 'to', 'be', 'in', 'the', 'AtlAntic', 'then', 'herring', 'got', 'overfished', 'Ocean', 'abundant'] [/code] The function sorted() creates a new sorted list and does not modify …

Member Avatar for JoshuaBurleson
0
112
Member Avatar for hughesadam_87

I'm not sure but I'm guessing that something like that would differ for each device, and of course there's the possibility that it may have a domain-specific like language connected to it. I'm intrigued by the idea though. Not to digress but on a semi-related topic I recently came across …

Member Avatar for hughesadam_87
0
178
Member Avatar for Fyrox
Member Avatar for Fyrox
0
5K
Member Avatar for pelin

Why are you having the user input the number of transactions? It just seems to me like that would become repetitive since most transactions in a month are only made once. To subtract the amount from the total balance you should - from current balance. I'll give you a hint …

Member Avatar for pelin
0
370
Member Avatar for Coopish

I think it's pretty important to incorporate functions, ESPECIALLY since you're a newbie. It wasn't that long ago that I was wrapping my head around functions. They're great because the can be used more than once, it's also a quick concept to begin to understand, it's simply a way of …

Member Avatar for TrustyTony
0
770
Member Avatar for twgray
Member Avatar for JoshuaBurleson

I'm trying to figure out how to allow users to upload images, I'm starting easy with something I know tkinter can handle with no coercion, gif files. I've figures a bit out, but I'm having issues getting the image to actually SHOW. [CODE]from tkinter import * from tkinter.filedialog import askopenfilename …

Member Avatar for TrustyTony
0
3K
Member Avatar for mahela007
Member Avatar for freebordist

raw_input is used for user input on the command line, or in IDLE for example:[CODE]word=raw_input('Enter a word: ') print word[/CODE] it is important to note that raw_input does not work in python 3.x it was combined with input() after python 2. If you're not sure which one you are using, …

Member Avatar for JoshuaBurleson
0
184
Member Avatar for MikeTheHero

Well Mike, welcome to Python, I'm sure you'll love it. Here's a snippet by Vegaseat regarding TG [URL="http://www.daniweb.com/software-development/python/code/216557"]http://www.daniweb.com/software-development/python/code/216557[/URL] Also there are tons of free ebooks on learning python, some handy tutorials at [URL="http://thenewboston.com"]http://thenewboston.com[/URL] "I didn't use them, but I viewed them after I learned the material and wished that I …

Member Avatar for JoshuaBurleson
0
147
Member Avatar for Tomashqooo
Member Avatar for JoshuaBurleson
-2
153

The End.