Posts
 
Reputation
Joined
Last Seen
Ranked #64
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
96% Quality Score
Upvotes Received
584
Posts with Upvotes
494
Upvoting Members
185
Downvotes Received
15
Posts with Downvotes
15
Downvoting Members
14
133 Commented Posts
~2.51M People Reached
Favorite Tags

2,190 Posted Topics

Member Avatar for Steph102

[QUOTE]Hey I did this in class the other week. This code is simple and works perfectly [code]import random Num = int(raw_input("enter number of coin flips:")) coinf = 0 h = 0 t = 0 while coinf < Num: coinf = coinf + 1 rand = random.randint(0,2) if rand == 1: …

Member Avatar for Dani
0
16K
Member Avatar for vegaseat

[QUOTE=;][/QUOTE] You can't mention drinking without some of W.C. Fields' sayings "A woman drove me to drink and I didn't even have the decency to thank her." "Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake." Not drinking related, but one of …

Member Avatar for Reverend Jim
15
13K
Member Avatar for deepakgupta2186

You search a dictionary in this way, and note that names would be case sensitive: [CODE]def search(dict1): name2=raw_input("Enter the name whose number is to be found: ") if name2 in dict1: print name2, dict1[name] [/CODE]

Member Avatar for Mansour_4
2
23K
Member Avatar for Reverend Jim

I am watching fewer shows because of the commercials. To watch any show you have to be willing to watch the commercials, or as I am doing more and more now, recording the show and fast-forwarding through the commercials. If a commercial contains Debbie Boone or insurance sold by the …

Member Avatar for Reverend Jim
10
3K
Member Avatar for dseto200

See the last post here for the general idea [url]http://www.daniweb.com/forums/thread158680.html[/url] You want to use some variable in a while loop that you can set to false if (1) the correct word is guessed, (2) the maximum number of guesses is reached, (3) any other exit criteria. You can also use …

Member Avatar for Reverend Jim
0
3K
Member Avatar for Corey_5

Start with tkinter basics. As already stated, the Label isn't going to change, so using cget() on a label does not provide any useful data. Second, start with one get. You have 178 lines of code, and a lot of it is wrong and has to be changed. Take any …

Member Avatar for woooee
0
69
Member Avatar for Raviteja_1

Use subprocess.run() https://python.land/operating-system/python-subprocess It receives a list, so it is easy to include parameters. Be sure to read about the shell=True option and decide whether it is necessary or not.

Member Avatar for woooee
0
108
Member Avatar for daviddoria

Is this correct? from wxPython.wx import * In any case, you may have to install/re-install wxPython.

Member Avatar for Reverend Jim
0
2K
Member Avatar for moroccanplaya

I would guess the problem to be the columnspan or sticky parameters. You can try different combinations of those, but also might want to post to a Tkinter forum like [url=http://www.manning-sandbox.com/forum.jspa?forumID=51]Manning's[/url] as many of us use the Pmw extension which has scrollbars built in.

Member Avatar for TECH COFEE
0
2K
Member Avatar for Encray

Your indentation is off. Look at a basic tutorial and classes. https://wiki.python.org/moin/BeginnersGuide

Member Avatar for woooee
0
41
Member Avatar for Nadir_1

First, don't use pack() and place(). How is Tkinter to know which one to apply to the widget. Don't start multiple instances of Tk(). Same thing. How is Tkinter supposed to know which one you are referring to. Use a Toplevel() instead. This modified code does what I think you …

Member Avatar for woooee
1
63
Member Avatar for Scagli3tti

The standard solution for anagrams is to sort on the letters. So 'ogd' sorted is 'dgo', and a lookup of the 'dgo' key in the dictionary yields the list ["dog", "god"]. Your code would only return whichever one of these words it found first. Also, you should not use "dict" …

Member Avatar for michellepermsm
0
1K
Member Avatar for RoqueyB

[quote]The computer should make the user always select from a pile where the number of matchsticks has a remainder of 1 when divided by 4.[/quote] [code]import random # choose some random numbers and the appropriate number to pick up # so that the number of sticks = num*4+1 # no …

Member Avatar for Ben_493
0
9K
Member Avatar for usdblades

First try using idle instead of Notepad. You can enter, save, and run the program from Idle. It should be under the python and then idlelib directories, and is something like Idle.py-I don't remember. That will solve the immediate problem. Your solution should work also, so it may be that …

Member Avatar for Theofanis
0
2K
Member Avatar for markusd5454

You should put this in a function that you can call repeatedly instead of duplicating code.

Member Avatar for Reverend Jim
0
86K
Member Avatar for pwolf

The question itself is not clear [quote]from start to the end number (inclusive)[/quote]but the results do not include the end number [quote] range(1, 11, 2) will return a list of numbers [1,3,5,7,9][/quote].

Member Avatar for Reverend Jim
1
1K
Member Avatar for macroasm
Member Avatar for miltocke

Take a look at the "Starting Python" sticky at the top of this forum. There are many resources, including the Google (free) online course.

Member Avatar for Raunikkapoor
0
240
Member Avatar for Reverend Jim

The Xerox Palo Alto Research Center, known as Xerox PARC, developed the graphical user interface (GUI), laser printing, WYSIWYG text editors, and Ethernet. And perhaps more importantly developed object oriented programming.

Member Avatar for John_smith
10
21K
Member Avatar for glez_b

How do you determine boundaries? I would suggest that you post some stripped down code, i.e without all of the plotting, etc. as that has nothing to do with "outside boundaries". Include also an explanation of how you would like to determine what is outside the boundaries.

Member Avatar for rproffitt
0
1K
Member Avatar for Connor_1

Where does dollars come from, and how is it different from total_value def get_left_over_cents(pennies, nickels, dimes, quaters): total_value = get_dollars(pennies, nickels, dimes, quaters) left_over_cents = int(100 *(total_value - dollars))

Member Avatar for woooee
0
265
Member Avatar for TickleMeElmo
Member Avatar for woooee
0
1K
Member Avatar for Barnacle

You have to grid, pack or place widgets to get them to appear http://www.effbot.org/tkinterbook/grid.htm

Member Avatar for woooee
0
369
Member Avatar for linny_faith

>Can anyone help me? Not without knowing what you have tried. The number buttons is a simple for loop this_row = 2 this_col=0 for num in [7, 8, 9, "*", 4, 5, 6, "-", 1, 2, 3, "+"]: Button(btns_frame, text = num, fg = "black", width = 10, height = …

Member Avatar for slate
0
641
Member Avatar for linny_faith
Member Avatar for vegaseat

You have made the classic mistake of including even numbers = testing twice as many numbers. Start out with i=3 and add two on each pass.

Member Avatar for amir_19
3
24K
Member Avatar for vegaseat

The smallest time displayed is seconds. The function is called every 2/10 of a second, so the clock is not updated if the time to the second has not changed.

Member Avatar for Vinay_17
2
26K
Member Avatar for HiHe

So we are spending our time on simple toggles huh. This uses a list so the function has access to the previous setting. I was too lazy to create a class with an instance variable. try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk …

Member Avatar for martineau
1
21K
Member Avatar for HimaniBansal

> chmod u=rwx,g=rx,o=r myfile "This example uses symbolic permissions notation. The letters u, g, and o stand for "user", "group", and "other". The equals sign ("=") means "set the permissions exactly like this," and the letters "r", "w", and "x" stand for "read", "write", and "execute", respectively. The commas separate …

Member Avatar for woooee
0
467
Member Avatar for surtr86

A simple split will do the trick test =""" [ "this is a text and its supposed to contain every possible char." ], [ "like *.;#]§< and many more." ], [ "plus there are even newlines in it." ]""" x=test.split('[\n') for rec in x: print(rec) print("-"*20)

Member Avatar for woooee
0
507
Member Avatar for chopsthescot

Generlly, you send the button number to the function. Also, you import Tkinter twice. Which one is the program supposed to use?

Member Avatar for rproffitt
1
2K
Member Avatar for maemae14

Using random.shuffle(), you can just then read them in order. http://www.tutorialspoint.com/python/number_shuffle.htm

Member Avatar for woooee
0
303
Member Avatar for vegaseat
Member Avatar for woooee
4
25K
Member Avatar for Jordan_15

Everything regarding the menu is usually in the same function def displayMenu(): print('Enter 1 to convert a string to uppercase:') print('Enter 2 to convert a string to lowercase:') print('Enter 3 to count the number of words in a string:') print('Enter 4 to count the number of vowels in a string:') …

Member Avatar for woooee
0
438
Member Avatar for r3bol

The error message doesn't make any sense as it only references line 3 > Traceback (most recent call last): File "<stdin>", line 3, in <module> IOError: [Errno 36] File name too long: '\xef\xbb\xbf<!DOCTYPE html PUBLIC "... which is from bs4 import BeautifulSoup Is BeautifulSoup installed correctly?

Member Avatar for happygeek
0
6K
Member Avatar for nadiam

Have BClass write to a separate file and combine them when the threads have finished. You could also use a thread safe SQL server, like MariaDB/MySql, but not SQLite.

Member Avatar for woooee
0
342
Member Avatar for nadiam

`if not read_file:`This statement is executed when bytes1 is **found** at the beginning of the file, offset/read_file==0). Use instead with open("foundhex.txt", "a") as found1: while True: read_file = bytearray(binaryfile.read(1024)) if len(read_file): find_bytes1 = read_file.find(bytes1, 0) if fine_bytes1 != -1: found1.write("Found 41646F626520 at : " + str(find_bytes1) + "\n") else: break …

Member Avatar for nadiam
0
394
Member Avatar for Fo.katia
Member Avatar for Ancient Dragon

From the kids: Where do you find a turkey with no legs. Right where you left it.

Member Avatar for jkon
4
4K
Member Avatar for Eashan

Use partial to pass something to the function, and the function will do something based on the value. This example prints what was passed to the function. Note that the Python Style Guide suggests function names should be lower case letters and underscores https://www.python.org/dev/peps/pep-0008/ root = tkinter.Tk() root.geometry("200x300") ##buttons=range(10) button_list=[] …

Member Avatar for woooee
0
463
Member Avatar for Eashan

You have two root=Tk() statements which Tkinter does not like. Also you don't have a mainloop(). And I have no idea what you want to do or why this program was posted here.

Member Avatar for woooee
0
423
Member Avatar for RafaelNinja13

Add a print so you know what is going on and where the problem is occurring. for ch in name: print("\nbefore", ch, total) total = ord(ch) + total - 96 print("after", ch, total)

Member Avatar for woooee
0
2K
Member Avatar for srinivasa reddy_1

k is a dictionary value for the Albert Einstien key `self.grades[name]` so you are trying to sum/add a dictionary `total+=sum(k)`. I would suggest that you print "grades" so you at least know what it contains.

Member Avatar for woooee
0
332
Member Avatar for Nemius

You SQL query is wrong. It should be obvious that SQL can not know which field in the record to update. See "Parameterized queries" at http://zetcode.com/db/sqlitepythontutorial/

Member Avatar for woooee
0
592
Member Avatar for _hack

The following works fine on my machine. Perhaps you should submit some of the data in the file as it may be corrupted. Also, has_key is being replaced with "in".[CODE]f = ["PUT key1 value1A", \ "Junk key1 value1", \ "PUT key1 value1B", \ "PUT key2 value2", \ "PUT key1 value1C" …

Member Avatar for woooee
0
18K
Member Avatar for Dihyan

Variables created in a function are garbage collected when the function exits so you have to return them to keep a variable. Any tutorial that explains functions covers this https://wiki.python.org/moin/BeginnersGuide/NonProgrammers

Member Avatar for Shankar.Shiv
0
506
Member Avatar for Chris_48

You don't need the lambdas. You are executing the function (parens follow function name) so that requires a lambda. Just pass the function reference. self.bind('<Enter>', self._label_enter) ## no parens ## and then def _label_enter(event=None):

Member Avatar for woooee
0
944
Member Avatar for Kippstah

This code works around using different names for the same variable, and using the same name for a function and a variable. You still have problems with your logic though but hopefully if will get you started in the right direction. [CODE]#THIS PART IS NOT THE CODE ITSELF THESE ARE …

Member Avatar for balaji_8
-1
17K
Member Avatar for funfullson

Try pexpect [URL]http://www.noah.org/wiki/Pexpect[/URL] or subprocess pipes----->Doug Hellmann's intro [url]http://blog.doughellmann.com/2007/07/pymotw-subprocess.html[/url]

Member Avatar for Krystor
0
2K
Member Avatar for Viasur

Try it with the complete path name. [CODE]reader = csv.reader(open("/path/to/mesaure.csv", "rb"))[/CODE] [QUOTE]After running the file on a Terminal I get the results I want but is no working when running the same file, measured.py, on the editor.[/QUOTE]This is too vague to comment on. What does "not working" mean?

Member Avatar for Gribouillis
0
4K

The End.