15,175 Topics
| |
I'm writing a program that checks a txt file with a list of words (one word per line). I'm just this side of done, I think. [CODE]def StripPunctuation(s): answer="" for c in s: if c.islower() or c.isupper(): answer=answer+c.lower() return answer def Reverse(s): answer="" for c in s: answer=c+answer return answer … | |
I am having trouble correcting the syntax on this problem so far and I can't seem to find my mistake any ideas on what I am doing wrong ? The object of the program is to ask user for amount of money to put in the pot, and play until … | |
i have no idea what this means... and i really need help starting my new python web app project... [CODE]root@ubuntu:~# python solif/manage.py syncdb Traceback (most recent call last): File "solif/manage.py", line 14, in <module> execute_manager(settings) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File … | |
hi, am trying to work this one out for dictionaries. I have this 2 dict that i want to merge. a= {16: {(7, 8, 0): {0: 4, 1: 5, 2: 6, 3: 7}, (7, 7, 0): {0: 0, 1: 1, 2: 2, 3: 3}}, 18: {(7, 8, 0): {0: 12, … | |
I'm trying to use the exec command in python to try to get a function to call on different dictionaries and functions as needs change without making my program bigger than it needs to be. Unfortunately I keep getting this error: File "Game Files\Intro.py", line 214, in Anim exec compile('%slegs … | |
say for example the first 5 apples you buy cost .50 and the next 5 apples you buy after that cost .40 and every apple after that is .30. How would I go about creating a function that could tell okay apples 1-5 cost .50 then add any extra in … | |
Hello, I am a very entry level python user so my knowledge is behind at the moment but I am have a problem creating a function that will take an x range and pass it through as a parameter to my function and output all the results. For example this … | |
Hello, i'm new to python, I mostly program in C++. i'm adding values, but it doesn't give me the right answer. [CODE] x = input("Enter number: "); y = input("Enter a another number: "); z = x + y; print("Answer is: " + z); [/CODE] if i enter 5 + … | |
I have a wx Gui that gathers all the necessary info and starts an external command line app. Whilst it is running my gui freezes as you'd expect so I've been experimenting with putting the external app in a thread of its own. My original code ends with the line: … | |
So im trying to create a times table: Write a program to print a multiplication table (a times table). At the start, it should ask the user which table to print and how high the table should go. The output should look something like this: Which multiplication table would you … | |
Trying to help my brother who has just started learning Python at school. He's not the brightest so any help is appreciated. I consider this quite hard for someone who has barely started, although he has missed a few lessons through illness. Solution is welcome but please try to explain … | |
Hello, I am learning python and am having trouble getting this program to work correctly. [CODE]from Tkinter import* import time import tkMessageBox import random def Questions(): number1 = random.randrange(1,25,1) number2 = random.randrange(1,50,2) answer = number1 + number2 prompt = ("Add " + str(number1) + " and " + str(number2)) label1 … | |
I am new to python and cant figure out what I am doing wrong with the global variables. Here is an example of the problem I am having. number = 0 def test(): global number number = raw_input("Please type a number.") def prints(): global number if number2 != 1: print … | |
I'm probably missing something really obvious, but I downloaded the Python 2.72 release, and now I can't figure out what to do. I've tried googleing it but everything says to just install it. Is that install the setup.py file? If it is, how do I run a python file if … | |
I started making a simple drawing program, to use for a level maker, and I came across a slight issue [CODE]from Tkinter import * class Main: def __init__(self,root): w,h = root.winfo_screenwidth(), root.winfo_screenheight() current = {} canvas = Canvas(root, width = w, height = h, bd=0) canvas.pack() root.overrideredirect(1) root.geometry("%dx%d+0+0" % (w, … | |
Hey i'm trying to place a ship onto my grid but my translation function is trying to iterate over None type, if someone would write a simple horizontal ship placement in translation function i'm sure i can finish the rest, thank you! [CODE]class start(object): def __init__(self): self.GameT = int(raw_input("One Player … | |
[CODE]sizeA = 2**28 M = [0]*sizeA[/CODE] The above code creates an array but, each element is 4 bytes each. How do create a large byte array with type 'B' (eight bits unsigned)? I would like it to be as large as possible. I need it for a sieve prime number … | |
Hi. I have a small dilema. I have 1 Picassa .ini file a contacts.xml file and a few images all in the same folder. On the images there are certian people, picassa.ini file holds the image name and id's of people included on that image in such format: [CODE][img_8538.jpg] faces=rect64(4ac022d1820c8624),d5a2d2f6f0d7ccbc … | |
For school I have to write a program that requests a 3 part name and breaks it into a first, middle, and last name. I wrote the code but the alignment of my output is not right. I was wonderng if someone can tell me what I did wrong and … | |
Hello guys, just joined the community. Found it through google. :) I am basically new to python, only couple of days of knowledge. I am trying to make all the words in a txt file appear in 4 or 5 in a row. so the txt file looks like this: … | |
For school I have to write a program that requests a 3 part name and breaks it into a first, middle, and last name. I wrote the code but the alignment of my output is not right. I was wonderng if someone can tell me what I did wrong and … | |
Hi, Just started learning python..and want to learn to do this I want to read a text file that something like 10000 20000 30000 40000 20000 30000 88888 88888 60000 12333 44431 12345 I want to get the difference of numbers in column1 divided by x, where I want to … | |
(I'm new to programming in general) I created a program in python without an interface and part of it used a raw_input to get a users answer and compare with a stored answer. This was in a loop that limited the number of attempts the user could have. This worked … | |
So, even thou I have searched throughout the forums, I couldn't get a clear answer, maybe perhaps I'm a noob @ Python. As a beginner, I don't know much about Python, and it's frustrating to search the net and not find the actual answer. So, I'm working on this project, … | |
Hello, pls can anybody show how works printing? here is the code: [CODE]class Student(object): def __init__(self, name): self.name = name self.report = dict() def add_subject(self, subject): self.report[subject] = list() def subjects(self): return self.report.keys() def s_subjects(self): lpre=[] for subject in self.subjects(): lpre.append(str(subject)) print lpre class Subject(object): def __init__(self, name, teacher = … | |
Hi.. I'm a first time poster so please excuse any idiocies.. I'm a third year software design student and I am on my Industrial placement. I have been given the task of parsing 100's of word documents. I am required to extract the information stored in certain tables and export … | |
Hi everyone! Am new to python, getting grounded in it as fast as i can but now, i have some issues. I use the web2py framework for web development. At the moment, am working on a blog using one of the CMS (named InstantPress) designed in web2py also. While editing … | |
i've been having trouble figuring this out since im new to python and i really wanna figure it out! Write a Sentinel controlled While loop that allows the user to enter text until they enter ! by itself. Output would be like this: Enter some text: Hi Enter some text: … | |
Hi, I'm pretty new to python, just started 2 weeks ago xD, and new to forum too, I tried to search to see if there were any other question that was similar to this but couldn't find one. Therefore, I apologize if there's already another thread with the similar problem. … | |
I have a problem that I have been working on. I felt like I was getting close just to find out with wasn't the 100% correct way of doing it. What I need to do is take a list of names from a file in the format last, first, middle. … |
The End.