15,190 Topics
![]() | |
Hi Everyone, Sorry if this has a totally obvious solution. I am trying to write a simple cows and bulls game; the program generates a secret number, the player has to guess it, the program then compares the guess to the secret number and tells the player that either they … | |
I have program than finds the minimum temperature of every month, but i can't find a way for it to find the minimum temperature that is higher than 0, i can't just use min() cos if the month has temperature that is lower than 0 it is also counted. | |
So I'm interested in learning about data validation. Especially in Python. Python all ready has several common idioms for data validation. There are several statements that evaluate data. For instance, isinstance(object, classinfo) will check that the given object is an instance of the class or type in classinfo. One idiom … | |
Hello everyone, new programmer here. In my class we have an oppurtunity to make up credit on a previous homework by modifying a program if we got any of it wrong. The problem for the progam was: Problem #4. Write a program to solve the following problem. Find a word … | |
![]() | I am trying to specify which variables a function should return. The purpose of this is to allow the function to return different sets of variables according to the requirements of another function, in order to make things more efficient (rather than always returning all the variables): [CODE] # Python … |
I want to call another object's methods from another object, and I have no idea how. Can someone please help me? Thank you. | |
Hi, I'm looking for a little help with the function "getattr". Here's my code: [code=python]class MyClass: def __init__(self): trycmd = getattr(self, "cmd_testing") try: trycmd() except: print "Fail." def cmd_testing(self): print "Victory!" obj = MyClass()[/code] So, when I run this code, I get the output "Fail.". I'm not sure what I'm … | |
I am new to Python and am trying to marry a Python module with a CGI interface. I understand a little of both but not how they work together. I created a class called Vehicle and (using IDLE) and am able to import it and set the year, make, and … | |
Alright, this is how my newest program looks like: [CODE]import math def main(): print('This program finds the real solutions to a quadratic') print s = float(input('Please enter the coefficients (a,b,c): ')) a, b, c = s.split(',') discRoot = float(math.sqrt(b * b - 4 * a * c)) root1 = (-b … | |
I finally got apache installed. I moved my .cgi python web application to var/www/cgi-bin however when I went to 127.0.0.1/cgi-bin/web.cgi but it said the web address didn't exsist. So I put the file in in var/www/ and it just read what was in the script, it didnt execute it. So … | |
This is my python script: [url]http://gsingh.pastebin.com/mc602006[/url] This is my setup.py file for py2exe: [url]http://gsingh.pastebin.com/m70a19449[/url] When I go to command prompt and run the .py file with the command, email.py message It works fine, it sends me an email with the message, which is what it's supposed to do. When I … | |
hi, im trying to make a program that simulates the game Risk. It should output something like this: [code] Attacking Army: Army A Defending Army: Army B Number of attacking army: 4 Number of defending army: 3 ----------------------------------- Round 1: Army A: 3, Army B: 2 Attackers' Dice: 5 2 … | |
I read the guidelines on posting homework questions and I think this one is within the rules. A little background, currently taking my first computer program class, its an online class (big mistake), it's very hard to get feedback or assistance. I have been ripping my hair out trying to … | |
In my file, I have lines similar to this <Log LogID="633198520" LogLevel="Normal" Date="10/01/09 19:18" Type="Error" Source="Mentor" Text="Failed to process the request." /> When the line is read, if it is converted as field value pair I thought it will be easy to take required field. Please advise how this can … | |
I need to gather data from a weather rss feed. But i ONly need certain "Variables, such as humidity, temp (high and low) etc. What I want to do is (i think) is parse them from Rss to integers in python. Any help would be much appreciated. :) | |
Hey, I'm brand new to Python and I'm sorry if my code/question is sloppy and ridiculous. I had to make a snowman for homework, but now I have to make the entire snowman move 6 times wherever the user clicks. I used this at first, but it obviously only moves … | |
Hi everyone! I'm trying to make a function in Python that converts a csv file into a xls file. I have to convert about 500 files so you understand that I need it to be as clean as possible. This is the code I wrote, just for one file later … | |
hi, i want to develop small games using python on mac. so which modules /libraries i have to import . and how to proceed to develop the game... plz tell me. | |
description: Reading data from active directory. some names have the French accented E. when I write to screen, no problems. when I write to a .txt file the program errors out with... [I]Traceback (most recent call last): File "ad-listing.py", line 20, in <module> print >> OutFile, person.displayname,"~",person.title,\ UnicodeEncodeError: 'ascii' codec … | |
though i'm calling pr() function in the subclass after calling the get_details() function(which assigns value to name) it doesn't print the current value of name. My question is if i want to print the value of name in the subclass what should i do???? I've tried in many ways using … | |
Here is my program: [I]#avg2.py # A simple program to average two exam scores # Illustrates use of multiple input def main(): print('This is a program to average two exam scores') score1, score2 = float(input('Enter two scores separated by a comma: ')) average = (score1 + score2) / 2.0 print('The … | |
ive got a sample game from college and i would like to open it a see how the game is but when i open it a blank window appears like ms dos and then closes i wonder if anyone could help out. ive installed python 2.5 and pygame. the code … | |
Having trouble getting code to allow the cars to go off screen then come back on the opposite side of the screen! for top to bottom and side to side! -The code i was trying was [CODE]if self.position > rect.top self.position == rect.bottom[/CODE] not sure if this is gonna work … | |
hi, how to implement the web services in python. I know, two protocols SOAP and WSDL are used in web services but i don't know how to use them to implement the web services . so can anyone tell me how to implement and develop the web services.. | |
Hello, I got a python script to send emails for my clients , that script is fired whenever i got new products in the store. i have like 4000 emails, but the server pops me an error when it hits the 1000 email. The error says the limit is 1000. … | |
Hi, I am having trouble producing my chart in the wx python gui. Keeps giving me an "ABORTED" message. Could you help if possible please? Code below : [CODE]import wx import cx_Oracle import datetime import wx.grid import csv import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab … | |
Hi, Newbie to this python lark so please forgive any silly questions - thank! Have installed various versions of python from 2.4 to 2.6 all with same issue. Current install is 2.5.4 AMD64 on XP64 platform. Python IDE doesn't do anything at all Python command line reports >> 'import site' … | |
HI guys, I am having some trouble with some basic python. I need to make a function that reads a document and divides each sentence up and counts the lenght of the largest sentence. this is what i have so far def linesize(F): c= 0 W= open("file.txt") X= W.read() Xlines … ![]() | |
Is it a good idea to help people with object oriented software design and code? I'm asking this because most of the code here is written using the functional programming, and all could probably improve a little or a lot with object oriented design and coding. My first doubt about … | |
Does anyone know how I can test if an object's type is a builtin type or a user defined type ? |
The End.