15,185 Topics
| |
:mrgreen: hi im am tryingto create a dimensional analysis thing going on and so far i have this [code] def mult(self,other): tempTuple1=list() tempTuple2=list() i=0 for unit,value in other.expr: for unit2,value2 in self.expr: if unit2 == unit: tempTuple1.append((unit, value+value2)) #self.expr[i]=tempTuple1 ## for unit2,value2 in self.expr: ## for unit,value in other.expr: ## … | |
Hello again: I seek assistance on what I believed would be an easy problem to solve, but, after much searching, I have not yet discovered a valid answer: I have a canvas which consists of a background GIF upon which (when triggered) at least one new (smaller) GIF will appear, … | |
Hello there, I am trying to write a script for an old 133mhz laptop I have, that will bind every key to different functions, and on a key press a different image, or video will be displayed, and/or a sound file. I have figured out how to bind keys with … | |
Hi: I am beginning to develop a project (game) that will be using graphics: I am trying to implement a view that is an image onto where other images will be added on "top"-- the other images do not have to move via user imput-- I just need to place … | |
Hi! How can i derive the used integer from variable a, when i use following code: [code] a = unichr(275).encode('utf8') [/code] When i try this: [code] print ord(a) [/code] It raises an error... | |
The dictionary currently has a few definitions in it, but it keeps only returning the definition for "noob". Anything that's entered returns that index. Why? Here's the code: [code]#1337 to Human dictionary: leet={"1337":"l-EET/nReally Awesome","noob":"(n00b) nOOb/nPerson who can't accept that s/he's wrong", "-xxors":"Suffix, pron: zors.\nUsed to accent an important verb, e.g. … | |
Hi all, What are your thoughts about how many and which type of errors should be caught and handled within functions, especially roll-your-own utility functions? For example: suppose I have a function that removes a directory and all subdirectories and files underneath it. Should that function test for path existence? … | |
I made a program that has no REAL purpose, but i did it solely to see if i could do it, because i am new to python (somewhat) and i did: It will open a .txt file, and add a word of your choice inbetween each word that exists in … | |
Hello, I am a wxpython newbie and would like some help on using custom classes to create and change widgets. I have a program with 2 classes, each of which creates a panel with widgets. These panels are then added to the main frame of an application. In one class … | |
Hello.. I'd like to renew my old perl-based website and I am thinking to Python compared with PHP for many reasons (not last that I can use it for many other things that just web-development). However there are tons of "web-frameworks" and I am very dishoriented with all this "offer".. … | |
Hi all, I am testing a somewhat large module, and I would like to automate the testing of the documentation (I know, I could just look at the code, but I wanted to make sure *and* the question became a cool one :cheesy:) Here's the basic idea: [code] for i … | |
OK, this is a minor quibble from someone who is not *normally* concerned with neatness. I want to put docstrings in my functions. If I put them in using the 'textbook' method: [code] def is_same(self,x): """A.is_same(x) --> Bool\n\nReturns True if A and x represent essentially the same item, as determined … | |
Does anyone have an idea about implementing two dimensional arrays in Python?? I want to write two programs: (1) a program for matrix multiplication (2) a program for displaying Pascal's triangle. Both these programs require two dimensional array..? Or is there any other way to solve this.. Thanks in anticipation.. … | |
Hallo: I am new to this forum and am very glad to be here. I am currently working on a Python project which will be using Tkinter for a graphical (Windows)(XP) output. I have studied Python while completing my software engineering degree but have not used it for 2-years. I … | |
Unique random variables. I've tried modifying the code in varying ways, but nothing is working. The program won't add new numbers to replace the ones that were duplicates. [CODE]import random b=0 numbers=[] print "show 6 random unique integers from 1 to 50: " while b < 6: for k in … | |
im realy new on python(started today) and i want to know how to write this script in python [CODE]#!/bin/bash function press_enter { echo "" echo -n "Press Enter to continue" read clear } selection= until [ "$selection" = "0" ]; do echo "" echo "PROGRAM MENU" echo "1 - open … | |
[quote]Print a 9x9 diamond shaped pattern.......using loops[/quote] [code]#written by Chris O'Leary: #Filename: star.py star=1 space=5 def star_decrease(star,space): while star > 0: print " "*space + "*"*star space = space+1 star = star-2 def star_increase(star,space): while star < 9: print " "*space + "*"*star space = space-1 star = star+2 if … | |
This program print the verse of "charlie was a pidgeon" 10 times, and finishes off with a cute little surprise. THE DEATH OF CHARLIE SHALL OCCUR! [code] #by Christopher O'Leary #The death of Charlie! def print_charlieVerse(): print "Charlie was a pidgeon, a pidgeon, a pidgeon." print "Charlie was a pidgeon, … | |
Based off the Self defence class skit: [CODE]# Filename: Madlibs.py noun = raw_input("Type a noun: ") verb = raw_input("Type a verb: ") adjective = raw_input("Type an adjective: ") sound_disgust = raw_input("Type a random sound of disgust, eg 'Uuurh': ") noun1 = noun verb1 = verb adjective1 = adjective moan = … | |
The code won't even display the root, let alone the menus. Even when the conversion works, nothing else does, so what do I do? [code]from Tkinter import * root = Tk() def hello(): print "Hello!" def metres_to_centimetres(metre,cm): metre = input("Put in a distance in metres: ") cm = metre*100 print … | |
what does [I]transient[/I] method do? please help me out....... thank u. | |
I really don't think that text adventures, even simple ones are within my grasp. How would you do that anyway, write a seperate Data file for each room or something? They seem very complicated, even the one in the Programs for Beginners thread. Bear in mind, the tutorial missed a … | |
I've encountered the following problem: Our program has two parts - the algorithm which is written in python (with numeric), and the GUI written in java. We want them to be able to work together - that means that the java part could ask the python for a calculation and … | |
Hi,:p Im totally unfamiliar with python - and need a little help. Im trying to add one command to superkaramba theme - it must be done in python file I know how that command looks when given from command line (bash) command is: [B]dcop knotify default notify eventname appname 'You … | |
Can you do these in the IDLE converter, or is it not powerfull enough, as I don't want to download 2 more programs just to expand my Python knowledge. Can I make graphics in the IDLE interpreter, and if so, is there a tutorial to help? | |
It is very annoying, I have typed it as best I can, but option 2 doesn't work. Option 1 is to take the test in Test.py, option 9 is to quit, and option 2 is supposed to print all the questions and answers. This is the code: [CODE]true = 1 … | |
Need help. How do I fix this code? [CODE]max_points = [25,25,50,25,100] assignments = ["hw ch 1","hw ch 2","quiz ","hw ch 3","test"] students = {"#Max":max_points} def print_menu(): print "1. Add student" print "2. Remove student" print "3. Print grades" print "4. Record grade" print "5. Save Students" print "6. Load Students" … | |
A friend of mine just introduced me to the Eclipse IDE, which may or may not end up replacing IDLE for me. Anyway, one of the features of Eclipse is error warnings as the code is *displayed*, rather than waiting for errors to pop up at runtime. This code got … | |
I have a problem: How to insert raise in Text()? for example i have file: [code] #my_program.py a=ddd [/code] and other file: [code] #my_file.py: from Tkinter import* root=Tk() text=Text() text.pack() execfile('my_program.py') #text.insert(END,raise) mainloop() [/code] In file my_program is Error. How to insert raise of this error in Text? thanks | |
I have a dictionary defined say D, I also have initialized it. When I say len(D), some time it gives me correct answer, but some times it throws me error saying [I]UnboundLocalError: local variable 'len' referenced before assignment[/I] can anybody tell me why is this error. Am I wrong some … |
The End.