15,175 Topics

Member Avatar for
Member Avatar for kjock002

so im trying to simulate a walk where the user will randomly take either a step forward or backwards, hence using the probability of a coin flip. i think the program is pretty much self explanatory. i just need help debugging it because it doesn't seem to work properly yet. …

Member Avatar for jcao219
0
179
Member Avatar for girlscodetoo

Hi Guys! I am a Python noob. I wanted to merge data and eliminate duplicates. I have the solution. Now I am stuck at dumping the dict contents to MySQL. Any help is really appreciated. Data : [QUOTE]a b c d e f key dupe -------------------- 1 d c f …

Member Avatar for girlscodetoo
0
182
Member Avatar for JJBallanger

Hi there, As a student I am new to python and am struggling with the following program I have been tasked to create. My code so far is like so. The idea is that the function will take a guess x, incorporate an arbitrary function f(x) and then take feps, …

Member Avatar for JJBallanger
0
229
Member Avatar for alabay2010

Hello everyone! I have task to write a program that would read a data from any txt file and visualize it on a bar chart using turtle module. I have to structure the program using modules and functions for nice design. The program must be fit for any other txt …

Member Avatar for TrustyTony
0
621
Member Avatar for zoro007

Hello, I want know how to find some of words in a file. For example : find one word [CODE]if "word" in open(file).read(): print file[/CODE] I wand do that but with 5 words [ word1 , word2 , word3 , word4 , word5 ] If find word1 or word2 or …

Member Avatar for sebcbien
0
161
Member Avatar for belboy

Country Gold Silver Bronze Total US 9 15 13 37 GE 10 13 7 30 CA 14 7 5 26 NO 9 8 6 23 AU 4 6 6 16 RF 3 5 7 15 KO 6 6 2 14 CH 5 2 4 11 SW 5 2 4 11 …

Member Avatar for TrustyTony
0
112
Member Avatar for kjock002

i found this code [URL="http://www.daniweb.com/forums/thread233959.html"]here[/URL] and i tested the code and it isn't working for me this is what my code looks like: [CODE] # PURPOSE: to count the number of words, lines, and characters in a file # # INPUT(S): a file name to be used # # OUTPUT(S): …

Member Avatar for TrustyTony
0
2K
Member Avatar for ihatehippies

Anyone know of a way to tell the difference between an inherited class method and a individually defined one? ie: [CODE=python]class test(str): def unique(self): pass x = test() # how to test for difference between x.unique # and x.lower[/CODE]

Member Avatar for ihatehippies
0
73
Member Avatar for pareshverma91

can any one please give me a link from where i can find out how python executes internally,i mean the way objects are declared, stuff stored etc.

Member Avatar for scru
0
106
Member Avatar for peppermints

[CODE]from Tkinter import * import random weapons = ("rock", "paper", "scissors") class Application(Frame): def __init__(self, master): Frame.__init__(self, master) self.grid() self.create_widgets() def create_widgets(self): Label(self, text = "Choose your weapon!\n" ).grid(row = 0, column = 0, sticky = W) Label(self, text = "Weapons:" ).grid(row = 1, column = 0, sticky = W) …

Member Avatar for jcao219
0
713
Member Avatar for Enders_Game

***Editted: added second problem I have this code, how do I make it stop once it's found the first instance of the [B]if[/B] happening. break, myparser.close(), and return don't work. [CODE]from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a' and (attrs[0][1].find('downloads&showfile') != -1): print(attrs[0][1]) print(attrs[1][1]) …

Member Avatar for Enders_Game
0
169
Member Avatar for Diomedes

Hello Python forums, I started working with Python recently and picked up a book. The book stated discussing using the ctypes module in python which is slick because it's exactly what I need to be learning. I started trying to test my knowledge by implementing a simple, singly linked list …

Member Avatar for TrustyTony
0
683
Member Avatar for biomed

I have files that contain lists of lists. Each file has about 20.000 lists that each list member is a list of itself with 15 values. Think of it as a database table. I know we can use a binary search to find a member of a list but can …

Member Avatar for sneekula
0
137
Member Avatar for Sauronevileye

I want to get a list with just folders (without subfolders). Any idea how to do that ???

Member Avatar for Sauronevileye
0
149
Member Avatar for the_mia_team

I will donate $10 via paypal whoever can help me with this code. heres my assignment [QUOTE]Write a Python class named "Car" that has the following data attributes (please create your own variable names for these attributes): - Year_Model (for the car's model) - Make (for the car's maker) - …

Member Avatar for Mensa180
0
4K
Member Avatar for helios0684

Hey guys, first time poster, relatively long time reader -- I am struggling creating a buffer class in python for my class. (relatively new to the language). Here is the basic idea I want to do: Implement a class that buffers text. The write() method adds a string to the …

Member Avatar for helios0684
0
2K
Member Avatar for PhrackSipsin

Hello All, I'm pretty new to python but have been programming, for a few years hobby wise and decided to try python after I found how concise the syntax was and with a computer science bent. So I'm writing a little code for a work related thing, simulating some basic …

Member Avatar for woooee
0
166
Member Avatar for wtzolt

Hi, I've made a small program which has 2 buttons and each does certain thing. Here's a simplified version of the code. Thing is it works fine except that the button freezes and stays in a clicked position and whole GUI freezes until the command is completed. As far as …

Member Avatar for jcao219
0
141
Member Avatar for ultimatebuster

Is it possible to limit a certain variable to only certain type? For example, i have a class named AccurateStr. How can I make sure that the variable "as" is an instance of AccurateStr? Similarly, how can I make sure a variable is a positive int, str etc without the …

Member Avatar for ultimatebuster
0
562
Member Avatar for vineshn

hi, I am new to python :). I am having a file say "test.c" test.c file contains test1 test2 test3 test4 and my output should be write in a file as newtest.c... -h test1 -e temp -x temp2 -o temp3 -h test2 -e temp -x temp2 -o temp3 -h test3 …

Member Avatar for vineshn
-1
133
Member Avatar for leviaeon

i am having an error with this simple bluetooth console it has error that says: NameError: name 'sys' is not defined call') here is the code sorry i am a noob in python i am trying different samples for me to learn hope somebody will enlighten me: [code=python] import socket …

Member Avatar for leviaeon
-1
118
Member Avatar for Sync.Void

Hello all, I normally lurk around and solve most of my issues by reading other threads. I have run into an issue and I am trying to figure out what I am missing. I am rather new at this so thanks for any advice. What I am attempting to due …

Member Avatar for Sync.Void
0
171
Member Avatar for leviaeon

i have a problem... i am new to python... and i have found a program that reads an sms directly from the phone's inbox... i am using nokia 6600... i just want to ask how will i be able to copy the sms file to a string? here is the …

Member Avatar for leviaeon
0
102
Member Avatar for jcao219

Most people would do something like this: [icode]input("Press any key to continue") #or raw_input[/icode] This way, if the user presses a key other than the Enter (return) key, then the program will still continue. It looks something like this: [URL="http://i42.tinypic.com/2yvp9hj.png"]http://i42.tinypic.com/2yvp9hj.png[/URL]

0
217
Member Avatar for Tops

US --9--15--13--37 GE --10 --13--7--30 CA-- 14 -- 7 -- 5-- 26 (those dashes are meant to be spaces) How do i remove the first column of the text above so the output would look something like this? 9--15 --13 --37 10 --13--7--30 14 --7-- 5--26

Member Avatar for TrustyTony
0
2K
Member Avatar for klebron23

Hello, I have a question pertaining to Python. I have been using the online book "How To Think Like A Computer Scientist" and have been doing the questions at the end of the chapters. I cannot figure out how to modify "num_digits" so that it works as expected.I have tried …

Member Avatar for woooee
0
201
Member Avatar for thompsonSensibl

Hi folks, ThompsonSensibl, so I'm new to Python. This is probably a noob question... I want to convert a String input to an Integer. I usually do it like this: number = int(someString). However this time this approach doesn't seem to be efficient at all. So far I have: [CODE] …

Member Avatar for megaflo
0
7K
Member Avatar for wtzolt

Question regarding compiling *.py script. Everything works fine when I compile the script except that there is no "theme". It looks like it's using win 98 skin or something. Looks very bad. Would like to know how to preserve [COLOR="Green"][I]gtk-theme-name = MS-Windows" [/I][/COLOR]. Which packages or modules should I include …

Member Avatar for wtzolt
0
118
Member Avatar for LabPsycho

Please can u read two list of numbers into an array and merge sort them in an ascending order into 1dimensional array

Member Avatar for jlm699
0
81
Member Avatar for qq263020776

now i have a finished template which wrote by j2ee,like this: <#list dailyStarList as dailyS> <li <#if (dailyS_index % 2) == 0>class="list_color_w"<#else>class="list_color"</#if>><h2><#list chatAvatarList as cal> <#if dailyS.avatarid == cal.id> ${(cal.name[0..1])!''}之星 <#break> </#if> </#list></h2><h3><#if (dailyMemberList)??> <#list dailyMemberList as dm> <#if dailyS.idx == dm.idx> ${(dm.myname)!''} <#break> </#if> </#list> </#if></h3><h4>${(dailyS.dailyNum)?c!''}</h4></li> </#list> And Now …

0
48

The End.