15,179 Topics
| |
TypeError: 'float' object has no attribute '__getitem__' What does this mean ??? | |
Hello, I have this functions: main(), menu1(),menu2() and so on. Main function takes an input and call one of the menu() functions so ... menu1(),menu2() functions needs to be defined before the main() function. The problem appears when i want to call the main() function inside one of the menu() … | |
I am trying to write a program to generate hailstone sequences for different starting values of n and have achieved this. Now however, I am trying to find the average length of the sequences and what the longest and shortest sequences are in the range(5,1000)and am not sure how to … | |
[B]Intro[/B] C is using structures to group data, mostly data that belongs together. Here we have some data that a campaign manager might keep for the volunteers. First we take a look at the C code: [code=c]#include <stdio.h> struct person { char *name; char *sex; char *slogan; }; int main(void) … | |
I creating a test program for TKinter, and getting some errors :( from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT) self.hi_there = Entry(frame, text="Hello", command=self.say_hi) self.hi_there.pack(side=LEFT) username = StringVar() name = Entry(frame, textvariable=username) name.pack(side=LEFT) print name.get() def say_hi(self): … | |
Hey there, so I recently joined an online course, and the first mini-project is to create rock, paper, scissors, lizard, spock. upon testing my program it seems I've got an error in my code and I can't for the life of me figure it out, I was hoping you guys … | |
Hi, I'm in an intro to Computer Programming class, and we need to make a program that rolls 5 die, and tells you if you have any combinations (pair, 3 of a kind, 4 of a kind, 5 of a kind, and Pair+3 of a kind) My program rolls perfectly, … | |
Hi, I was wondering if there is a way to click at a certain point in the figure thats made, and make python pick up those values. So I can see the value of x f.ex in the down left corner in the figure. So my question is if it … | |
This Python Tkinter GUI toolkit code draws a shape, and shows you when and where the mouse has been clicked within the shape. | |
Hey guys, I'm in an introductory computer science class that deals with Python. We're assigned to create a dice-rolling program using Tkinter, and I have the interface pretty much down, but I'm having trouble linking it to the dice-roller. Here it is. import random import Tkinter win = Tkinter.Tk() win.title("Die … | |
I have a little problem to solve .. i have a array with x, y, z co-ordinates in it as a tuple. I am trying to find the distance between each point and sorting the points according to the min distance. Can soemone help me with the algorithm ?? | |
There is always room for optimizing primelist functions. Here is an assortment timed with Python module timeit ... | |
def CalcCentre(data): centre = array([0,0,0]) count = 0 for p in data: centre = add(centre, array(p[:3])) count += 1 centre = dot(1./count, centre) return centre | |
I am trying to run a program from python command line. I installed python on D: drive. PLZZ help me in fixing this problem. | |
hi i have been trying to draw a stick figure, but i don't know how to start, pls i need a help. | |
I am looking at python and I want to allow the user to click on the centre of the screen and create a circle, this is what I have. Any help will be very appricated. import from graphics * def blueCircle(): win = GraphWin("Click Here") p = win.getMouse() circle1 = … | |
The difference of this program from other rock-paper-scissors from is that this program ask the computer the select the weapon most likely to beat the user,based on the user's previous choice of weapons instead of using random function. #This is a program that will allow the user to play Rock, … | |
Hi, i have a 2D list in python which i'm trying to fill using 2 for loops. but the problem is when i finish the filling procedure and i print the values, i find that they are not arrangeed in the order of input. def funcdist(myarr): diffs = 0 testarr … | |
| Okay, I thought I had this code solved: please help me..My code is not closing out..please point me to the right direction..very newbie to python # initialization phase count = 0 totalGrade = 0.0 toContinue = "yes" while toContinue != "no": moreStudents = "y" #processing phase moreGrades = "y" while … |
I want to be able to write a Python script to send a text message to a user's phone using an email client. I have tried the following code: import smtplib from email.mime.text import MIMEText msg = MIMEText('message') msg['Subject'] = 'The contents of %s' % textfile msg['From'] = 'example@mail.examplecompany.net' msg['To'] … | |
Hi guys, This feels like something that should be possible in Python, and something that I feel like I should know how to do. Image I have a list of numbers: items=[10,20,30] Let's say I wanted iterate over them and define two new variables, a and b. a=[] b=[] for … | |
hello ive been working on a small project and im a bit stuck. import subprocess path = "/var/log" #i wanna be able to do something like subprocess.call("nano path") # but i noticed that using nano like that wont work because path is just a python string any help | |
Hi all, I am looking at neat ways of re writing this code below, especially the for loops as I would have over 50 of these statements if I did this the manual way shown below. n = 50 files = [open("files%i.txt" % i, "w") for i in range (n)] … | |
| I am having problem with my python homework. My homework is asking to create a Python program to calculate a student test averages regardless of how many tests will be averaged. Also, it is asking to allow the teacher to continue averaging grades for any number of students. This is … |
Thank you for looking at my issue. I am a beginner in school and we have an excercise that asks us to write a program that uses nestes loos to draw this patter: ******* ****** ***** **** *** ** * and ** * * * * * * * * … | |
While at work i had nothing to do so i wrote this simple python script that uses the dbm module to store user information its not perfect but im sure someone will find it helpful. | |
I'm creating a python rest api wrapper to a website, i created a file called api.py, then used called the api using [requests](http://docs.python-requests.org/en/latest/), like so: `requests.get('http://example.com/api', auth=('username','apikey'))` How to create a class nammed Class1, then put the url in it using [urlparse](http://docs.python.org/library/urlparse.html), then create another file called example.py, call the … | |
Hi guys, I'm pretty new to Python and having some issues. I have some data points in first and second column. First column is elapsed time. I am trying to implement a differential interval condition which goes as following: ln(t_i+j)-ln(t_i) >= exp(0.2) ln(t_i)-ln(t_i-k) >= exp(0.2) My code so far:P So … | |
How to change font size in win32print module? Win32print works but the font size in virtual printer or local printer is too small (maybe size is 9), but required size maybe 14. Or alternative for win32print? |
The End.