No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Python noob and xbox fanatic
19 Posted Topics
Keep getting Attribute Errors with my code any suggestions? There are two files attatched [code] from string12 import * from root import * def main(): tree1 = raw_input("enter numbers: ") print buildParseTree(tree1) def buildParseTree(fpexp): fplist = fpexp.split() pStack = Stack() eTree = BinaryTree('') pStack.push(eTree) currentTree = eTree for i in … | |
Help with passing the arguments. This program is supposed to ask for how many numbers do you want. I would stick with ten. Then how many numbers in a randrange (upper limit) Please choose 100 After a list is generated it is supposed to sort the numbers and look for … | |
Can someone help me with my queue? I think the stack works fine. I just need the indexing of the queue or do I need to index the queue? [CODE]from string12 import * from queue import * def main(): stack1 = Stack() queue = Queue() word = raw_input("Enter a word … | |
Trying to put the 4 queue.enqueue into a while loop. Any suggestions? Files are attached. [CODE]from string13 import * from queue import * stack1 = Stack() queue = Queue() pallist =[] pallist2 =[] def main(): stack1.push(4) stack1.push('2') stack1.push(1) stack1.push(5) while not stack1.isEmpty(): pallist.append(stack1.pop()) print pallist """while queue.size < len(pallist):""" queue.enqueue(pallist[3]) … | |
Trying to call the gcd from the constructor but I keep getting either a global error or gcd is not defined error. Any suggestions? The program is supposed to reduce fractions immediately. So I got rid of the add. [CODE]class Fraction: def __init__(self,m,n): self.num = m self.den = n gcd() … | |
Trying to find an easier way to write my code. I am using the graphics.py module. I will add the graphics program as an attachment for anyone who does not have it or doesn't know what I am talking about. The first program I made is archery. Just simple circles … | |
How would I pass something from a driver into a list inside a class. I then need remove a word from the list and replace it with a new word. | |
Really stuck on this and its supposed to be easy. I'm supposed to input 2 positive nonzero integers into x and y. Then return the value of x times y. The book has an example of 7 * 4 = 4 + 4 + 4 + 4 + 4 + … | |
I need to check for floating point numbers inside my class but it doesn't seem to be working. Any suggestions? [CODE] class Rectangle: def __init__(self, length = 1, width = 1): self.__length = length self.__width = width ##Setters to float def set_length(self, length): self.__length = float(length) try: #self.__length = float(length) … | |
I read a lot of car classes on several sites and still can't get mine to work. Any ideas? [CODE]##Car class class Car: def __init__(self, y_model, make, speed): self.y_model = y_model self.make = make self.speed = speed def set_year_model(self, y_model): self.y_model = y_model def set_make(self, make): self.make = make def … | |
Could someone show me how to add line numbers to a sorted list? If you need the code it is under the last thread I started. I started using document.write() but every time I did this the page would erase. | |
New to JavaScripting and copying information out of a book. I understand the concept of the code but I do not know why it is not working. I can type info in both boxes but the information does not add. Tried it in three browser FF, IE, and Chrome. [CODE]<html> … | |
Having trouble with the final loop in this craps program. Any suggestions. Problem starts on line 28. Was thinking about breaking the whole thing into functions but I don't exactly know where to call them at. When I do call them I get accessed before argument errors or something to … | |
First I like to thank everyone that helped me with my work... Please bear with me I don't know how to explain my problem. Trying to get the random number to remain the same through out the length of the program. When the player guess the right number the player … | |
Can someone explain how to add a file to a dictionary. The file is simple. Maybe a word or a number on each line. Here is the code I have. Didn't know if i should use this post or the List and Dictionaries post so kind of posted twice... sorry … | |
Re: Can someone explain how to add a file to a dictionary. The file is simple. Maybe a word or a number on each line. Here is the code I have. Didn't know if I should use this post or start a new one. Just in case I will start a … | |
Can anyone simplify this for me? I don't know if it is going to work I tried to adjust the code to fit on the page. Might have to delete the extra [ICODE]+\[/ICODE] [CODE=python]def main(): try: infile = open('text.txt','r') files = infile.readlines() lower,count,blank,dig = 0,0,0,0 #Counting uppercase for line in … | |
I think I have several questions before I post my code. [LIST=1] [*]How do I change the attributes? Everything looks the same and I was basically looking at one of the examples in my book for this problem. The book always has the arguments and attributes as being the same … | |
First time I've asked for help so please bear with me... ***Brain Freeze*** OK Supposed to open a txt file. Assuming the txt file is formated properly. The file is a what I am assuming a list of names and ages. I created my own file... kick me 989 bodybody … |
The End.