15,185 Topics

Member Avatar for
Member Avatar for bradrick42

I am working on some pre-processing. i have a group of text files whose names are dates (i.e. 20120201). data in each file is organized like this: 20120201_line number field1: 123124235 field2:ergjenrgjnergoiefoiefoenr . . field10:dfgkjndgknrkj 20120201_line number . . . The line number is the only thing that separates the …

Member Avatar for woooee
0
166
Member Avatar for F1Fan12

Hi All, I am writing a program in which I take data for a table from the user, and then ask for the alignment for each column. Then I have to display it. Each column mush be separated by a tab and a space. For example, let's say the user …

Member Avatar for woooee
0
5K
Member Avatar for nag18

Hi i am trying to create a game that uses 2 scripts one that creats the game instance and another that hold the varbles of monsters and the player as well as the game my problem is i am trying to creat "rooms" for each area with in the game …

Member Avatar for TrustyTony
0
94
Member Avatar for ThePythonNoob

I have two inherited classes in another class Class A(object): def printhello(self): self.message1="hello" Class B(object): def printbye(self): self.message2="bye" Class C(A,B): def __init__(self): super(C,self).printhello() def printboth(self): print(self.message1) print(self.message2) a = A() b = B() c = C() c.printboth() How do I super both A and B?, note this is just an …

Member Avatar for TrustyTony
0
2K
Member Avatar for Melly3

import random as r def main(): roll1 = r.randint(1,6) roll2 = r.randint(1,6) point= 4,5,6,8,9,10 sum= roll1 + roll2 print("phase 1") print ("You rolled:", roll1, "and", roll2) if sum == 2 or sum== 3 or sum == 12: print("Game Over. You lose" ) elif sum == 7 or sum == 11: …

Member Avatar for snippsat
0
3K
Member Avatar for alexandra.hoops.3

I have to write a program that asks the user how many pumpkin weights they have, and the reads that many pumpkin weights, printing each weight with two decimeal points and a comment and displays data about them to four decimal places. I need to find the average weight, maximum …

Member Avatar for ThePythonNoob
0
579
Member Avatar for ThePythonNoob

# Advanced game of Tic Tac Toe # Author: Bob # Version: TypeError #****************************** #import modules import random import mcommandline #****************************** class Human(object): def __init__(self): self.hposition = 0 self.hmove = ["X", self.hposition] self.question = "" def makemove(self): self.hmove[1] = input("1-9: ") def question(): question = input("Yes/No: ").lower() class Board(object,Human()): def …

Member Avatar for ThePythonNoob
0
274
Member Avatar for chao.lee.927

The UI is as following . http://img.my.csdn.net/uploads/201211/03/1351957960_1171.jpg What I want is : When I press the Enter key ,the label should shows “Enter” When I press The blank space key ,the label should shows “space” How to implement this ? I know I should reimplement the keyPressEvent handler ,but I …

Member Avatar for Lardmeister
0
133
Member Avatar for apayn

Hey Guys I have some code problem with my classes. Can anyone tell me what has happened? class Location(object): def location(self, index, desc, lootvalue=0, loot_type=0): self.index = index self.desc = desc self.lootvalue = lootvalue self.loot_type = loot_type self.nuetralmobspawn = nuetral_mob_spawn self.passivemobspawn = passive_mob_spawn self.hostilemobspawn = hostile_mob_spawn def __repr__(self): text = …

Member Avatar for Lardmeister
0
165
Member Avatar for ggauravag2012

if f(guess)-guess < epsilon: TypeError: unsupported operand type(s) for -: 'function' and 'float' This error message is being displayed. here is my code: def fixedPoint(f, epsilon): """ f: a function of one argument that returns a float epsilon: a small float returns the best guess when that guess is less …

Member Avatar for TrustyTony
0
826
Member Avatar for shanenin

These would seem to be equivalent but according to the interperter they are not. I have been banging my head with this for along time >>> a = '123456789' >>> a[0:9] '123456789' >>> a[0:9:1] '123456789' >>> a[::1] '123456789' >>> a[::-1] '987654321' >>> a[0:9:-1] #why is this not equivilent to a[::-1] …

Member Avatar for snippsat
0
121
Member Avatar for apayn

Hey! Sorry if the title looks a little odd and confusing. Basically what I want it to in my code, have Python input something as if it were the user. Does anyone know how to do this? Thanks Andrew!

Member Avatar for Lardmeister
0
209
Member Avatar for PhilEaton

Hello! I am having trouble getting the abspath when entering only an executable file. How can I fix this to return the full abspath? I am taking user input and opening a process (application). Here is my code: file = "/" + arr[2] + ".exe" print(file) path = os.path.abspath(file) print(path) …

Member Avatar for PhilEaton
0
415
Member Avatar for ThePythonNoob

Im interested to practice my python more in this area, for example I would like to do projects which would anyalyse a web page and look for a specific text or to send a post on to a site like twitter or facebook. I have no knowledge of this area, …

Member Avatar for Lardmeister
0
61
Member Avatar for sick vapor

Hello, I'm fairly new to python and I've currently run into a road block in this problem. I set up this code: def average(the_list): return the average of the list def deltalist(the_list,a): return a list which is each of the element of the_list subtracted by a def squarelist(lst): return a …

Member Avatar for sick vapor
0
2K
Member Avatar for Blacktono4

Hey guys, this marks my second post on the Forums. I recently asked about the def statement and the import statement. After that being answered I wanted to ask another question and thought best to start another thread. What is a class? What does it do and how does it …

Member Avatar for Lardmeister
0
322
Member Avatar for Blacktono4

So this marks my very first forum page on this great database of information named DANIWEB. So just quickly, as i am still in school and learning python, I really need to know, just an explination on: The def statement, what you can do with it and how to use …

Member Avatar for Blacktono4
0
114
Member Avatar for bigwill2010

Write a Python program that draws a circle with radius 50 pixels and centered at the center of the canvas. Give the canvas white background color and make it expand with its frame whenever the user resizes the frame. The program will respond to some mouse and keyboard events as …

Member Avatar for bigwill2010
0
8K
Member Avatar for dean.ong.14

My import random not working...... can anyone help me? and i need to make sure that people can quit in the middle of the quiz... THX import random # make input equal to Python3 style input even in Python2 def question (): try: input = raw_input except: pass question =" …

Member Avatar for dean.ong.14
0
288
Member Avatar for Delightfully

def exponents(num1,num2): if (num2==0): return 1 else: return num1*exponents(num1,num2-1) Hey I was wondering how I can generate a list of exponents using a for loop or a while loop so that the numbers display like this: Input (2,3) Output 2,4,8 What I have so far only returns the answer, Please …

Member Avatar for TrustyTony
0
2K
Member Avatar for d8m9

Hi, Iam trying to post a form with cookies using [Requests module](http://docs.python-requests.org/en/latest/). When I post the form and see the page with the results, there is an error in the page, saying that I didnt fill one field right. Iam absolute sure I fill that field right. When I post …

Member Avatar for d8m9
0
2K
Member Avatar for eleiloon

Hi All, I'm trying to make a tree and identify some 16s rRNA sequencing with genbank using biopython or python, but I have no Idea how can I start. Could you please help me?

Member Avatar for rubberman
0
114
Member Avatar for vargabbaruah

I have been learning Python for a month now and just finished coding my first Markov chain. def markovmaker(filename): import random fhin = open(filename, 'r') worddict = {} newlist = [] wordlimiter = 0 for line in fhin: wordlist = line.split() for word in wordlist[:-1]: pos = wordlist.index(word) if word …

Member Avatar for woooee
0
160
Member Avatar for krystosan

I have downloaded [PyDev](http://nchc.dl.sourceforge.net/project/pydev/pydev/PyDev%202.7.1/PyDev%202.7.1.zip) But I dont understand how to or what file to run...I know its a basic question but I am windows ga; used to run apps by clicking on icons...

Member Avatar for krystosan
0
156
Member Avatar for techyworld

Can someone tell me what is the difference between while(1) and while (true) in python?

Member Avatar for TrustyTony
0
138
Member Avatar for Inshu

How to load a yml file in python and work with it ?? I used : import cv data = cv.Load("Z:/data/xyz_00000_300.yml") But when I print data.. it just gives the detail of the image like number of rows and columns etc.... I want read what is there in the pixel …

0
111
Member Avatar for Frensi

Hi all, I'm trying to do this challenge from the book I'm following, but I'm so confused. I need to get a variable from one class, and use it as data in another class. As you see in my code, in the Shuttle class, I need to get the score …

Member Avatar for TrustyTony
0
258
Member Avatar for shills300

hi guys. our teacher posted a bonus a while ago that has me scratching my head. he still will not show us how to do it. i was wondering if u guys could crack it. here are the instructions: [Click Here](http://prntscr.com/inqqz) there are also **2 ** files to supplement: **.txt** …

Member Avatar for shills300
0
550
Member Avatar for nasnoma

supportData = {('nas','fat'): 0.5, ('nas'): 1.0, ('fat'):0.6, ('van'):0.72, ('jos'):0.55,('van','jos'):0.10} L = [('nas','fat'),('van','jos')] for freqSet in L: H = [''.join(list(i)) for i in freqSet] prunedH = [] #create new list to return for conseq in H: freqsetlist = list(freqSet) freqsetlist.remove(conseq) conf = supportData[freqSet]/supportData[tuple(freqsetlist)[0]] if conf >= 0.5: print freqsetlist,'-->',conseq,'conf:',conf When I …

Member Avatar for Schol-R-LEA
0
189
Member Avatar for ThePythonNoob

Hi I need some help with this code, at the moment I am just trying to get the commandline function to work. It should when I type a command like help or exit react to it, however I have to type the command 3 times for it to work which …

Member Avatar for ThePythonNoob
0
179

The End.