15,181 Topics

Member Avatar for
Member Avatar for Nachodsk

[CODE]class Personaje(object): def __init__(self,vida,posicion,velocidad): vida = None posicion = None velocidad = None recibir_ataque = None def recibir_ataque(vida): recibir_ataque in range(1,100) vida - recibir_ataque print "La vida actual del personaje es de", vida, " Luego de haber recibido", recibir_ataque, " de dano" def excepcionVida(vida): if vida <= 0: print "El …

Member Avatar for SgtMe
0
246
Member Avatar for shurshot

I have this bit of python code that imports pygames to draw lines. It auto creates lines when two or more points are clicked on. I'm bad at explaining but you'll see when you run the code. It's pretty simple but I find it kind of fun to mess with …

Member Avatar for Ene Uran
0
3K
Member Avatar for Dann0

Hey guys, I'm working on my game project for college, I have the code started, just enough to put the sprite on the screen and have a scrolling background. It is telling me there are no errors but when i go to run the game it terminates immediately, it's got …

Member Avatar for Dann0
0
185
Member Avatar for geosparovany2

Hi everyone....iam electronics engineering student and i have experienced some c++ ,i mean i know till oop basics... i want to learn scriptig language for EDA, i want to know which to learn...Perl or Python?....can python do everything perl can do??....i hear that perl is much harder to learn...is it …

Member Avatar for Tumlee
0
228
Member Avatar for sofia85

Hi, I want to create a matrix containing 20 rows and 2 cols. I know how to do this, but I have these two files; number and amount (each file contains 1 col and 20 rows) and I don't know how to add these files into this matrix that I'm …

Member Avatar for Gribouillis
0
153
Member Avatar for SamarthWiz

hi i'm having some trouble with web2py models: [CODE]# -*- coding: utf-8 -*- db = DAL("sqlite://storage.sqlite") from gluon.tools import Crud crud = Crud(db) db.define_table("shout", Field("author", "string"), Field("shout","text")) db.shout.shout.requires = IS_NOT_EMPTY [/CODE] (there is more but it is for the admin interface) It is all correct but I get this error: …

Member Avatar for SamarthWiz
0
246
Member Avatar for jeezcak3++

This is a program to extract/compile car NAV .KWI extensions. Unfortunately, I do not know anything about Python though I will love to learn some time very soon. Could you help me compile this into an executable file for windows 7? Will be reatly appreciated. [CODE]#!/usr/bin/env python # # kiwi …

Member Avatar for vegaseat
0
620
Member Avatar for Joey7

Hello, I have to count the number of words in a .txt file. Here is my program so far [CODE]import string ofile=open(raw_input("Please enter the name of a text file :")) s=ofile.readlines() print s word_freq={} word_list=string.split(s) for word in word_list: count=word_freq.get(string.lower(word),0) word_freq[string.lower(word)]=count+1 keys=word_freq.keys() keys.sort() for word in keys: print word,word_freq[word][/CODE] As …

Member Avatar for vegaseat
0
134
Member Avatar for caribedude

Hi, I'm very new to Python and programing in general and wanted to learn how to use the py2exe module. I think I've done the setup alright but I get an error message. Everything runs along smoothly until it start to make the dist folder. When it begins to make …

Member Avatar for patratacus
0
2K
Member Avatar for hemant_rajput

Hi, i've both pyhon 2.7 and python 3.2 installed on my windows PC. I downloaded and installed the module BeautifulSoup but it got installed only in python 2.7 how can i installed this also in python 3.2.

Member Avatar for Gribouillis
0
245
Member Avatar for eikonal

I've got a problem trying to replace keys (dictionary) that I have in a file, with its corresponding values. More details: an input file called event_from_picks looks like: EVENT2593 EVENT2594 EVENT2595 EVENT41025 EVENT2646 EVENT2649 Also, my dictionary, created by reloc_event_coords_dic() looks like: {'EVENT23595': ['36.9828 -34.0538 138.1554'], 'EVENT2594': ['41.2669 -33.0179 139.2269'], …

Member Avatar for woooee
0
360
Member Avatar for vegaseat

I am still trying to take a look at the gtk GUI package and reinstalled the following: gtk-win32-devel-2.8.6-rc3.exe and pygtk-2.8.2-1.win32-py2.4.exe (updated version) I have it down to a simpler error message now. Here are my warnings and errors with the sample file base.py [code]Traceback (most recent call last): File "D:/Python24/Atest/Demo/pyGTK/base.py", …

Member Avatar for vegaseat
0
294
Member Avatar for Tomie

I started taking a "introduction to programming" class a month ago, and the introductory language we are using is Python. Because I have never programmed before and only have a month's worth of experience with Python, please forgive my mistakes. So basically, here's the prerequisites to the "Piglatin Translator" assignment …

Member Avatar for woooee
0
853
Member Avatar for Azmah

I'm looking at learning Ruby (including Ruby On Rails) or Python (Including any of its frameworks - though which is better?). What are the pros/cons of each? Thanks in advance.

Member Avatar for Azmah
0
186
Member Avatar for huntaz556

i have things in a text file an index of movies that one owns and can add more but when i want to add a new one but when i have it print the line of a text file it just does this. i k o g n how can …

0
102
Member Avatar for madtowneast

I have been trying to figure out how to associate data with the event of checkbox being checked. The problem is that my data is stuck in a 5 keys deep dictionary (dict{dict{dict{dict{dict{}}}}}). I have tried crawling through the parents and getting their labels since they are created from the …

Member Avatar for woooee
0
360
Member Avatar for sofia85

Hi, I'm trying to execute an if loop inside a program to extract some values. But I only want to extract them if the following is true, [CODE]if ((letter in lines) == (letters in data)) and ((nr in lines) == (nr in data)) dt = a*c outfile.write(dt + '\n') elif …

Member Avatar for woooee
0
96
Member Avatar for pelin

i need to write a function changeName(name) that takes a string value as an argument. where name is in the form last,first,middle. the function should return a string that has the name in form fits,middle,last. [CODE][/CODE] name1 = input("Enter your name") def changeName(name): fields = name.split(",") return fields fields = …

Member Avatar for vegaseat
-1
91
Member Avatar for huntaz556

Hi everyone im making a program to keep track of your movies just keeping it simple ! but im having a problem i am writing what movies you have to a text file but i cant append to it every time i write to the text file it overwrites everything …

Member Avatar for TrustyTony
0
295
Member Avatar for as3g

Is there any way to shorten this function by way of an array, list or the like? I've tried various methods (no pun intended) but can't seem to make it work, I'm getting errors coming out the wazoo! I don't want the code, just point me in the right direction.[CODE]def …

Member Avatar for TrustyTony
0
90
Member Avatar for DoubleTapThat

Wrote this for my college open evening just to give prospective students a taste of python. added a little "information" section just to bulk it out a bit (this section is slightly messy i know). Not sure if it works in command line, definitely works in IDLE but the command …

Member Avatar for TrustyTony
0
317
Member Avatar for giancan

Hi guys, when I process some images (where apparently the dpi info is missing for python) I get a Keyerror: 'dpi'. Is there an easy way to capture this error or set the dpi to 72 if this info is not available? Thanks a lot

0
127
Member Avatar for beck4456

Hello, I'm working on a program that would print the prefixes of two user inputs if they matched. I'm thinking of this along the lines of if the value of the first character in a is = to the value of the first character in b, print the value. Next …

Member Avatar for TrustyTony
0
168
Member Avatar for just_starting

[CODE]def main(): distance, fuel = 0.0, 0.0 inStr = input ("Enter gallons and miles (with a space between):") while inStr != "": gallons,miles = inStr.split() gallons = eval(gallons) miles = eval(miles) print("MPG for this leg: {0:0.1f}".format(miles/gallons)) distance = distance + miles fuel = fuel + gallons inStr = input("Enter gallons …

Member Avatar for just_starting
0
164
Member Avatar for arson09

I'm really confused at the moment. I'm not looking for anyone to give me the answers, but if you could at least give hints on what i need to do in each method, i'll be happy!! FYI, one of the main things that's confusing me is that i'm not allowed …

Member Avatar for arson09
0
223
Member Avatar for graphicsgrl

I am new to python(version 3.2.11) and having some problems with this code...Please Help!! Here is the program I am supposed to write: Write a program which computes the fuel efficiency of a multi-leg journey. The program will prompt the user for the starting odometer reading and then for information …

Member Avatar for graphicsgrl
0
942
Member Avatar for ao_py

I have written a program that simulates volleyball using rally scoring. In rally scoring, the team that wins the rally wins the point, regardless of which team is serving (for this reason my program ignores the issue of who’s serving). Games are played to a score of 30 and must …

Member Avatar for Gribouillis
0
2K
Member Avatar for hemant_rajput

Hi, I need wrote a script which can go to particular site and download all the wallpaper or images available there. Can any one suggest me how to start with that. I never wrote python prog before but i know python. If anyone cn give me the direction it will …

Member Avatar for hemant_rajput
0
207
Member Avatar for sitmiller

I have a file with several lists of names with scores. Ex: Foo 3 4 5 4 3 80 90 40 I need to split the file and then make it so I can take the numbers and calculate averages, so the numbers need to not be seen by Python …

Member Avatar for woooee
0
200
Member Avatar for pelin

Jack loves to do jumping jacks. Create a simulation of Jack consisting of a stick figure and three buttons: start, stop, and quit. If the user clicks the start button, Jack begins jumping; if the user clicks the stop button, Jack stops jumping; if the user clicks the quit button, …

Member Avatar for pelin
0
463

The End.