15,179 Topics

Member Avatar for
Member Avatar for Inshu

TypeError: 'float' object has no attribute '__getitem__' What does this mean ???

Member Avatar for Lardmeister
0
751
Member Avatar for pauldespre

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() …

Member Avatar for TrustyTony
0
144
Member Avatar for La:)

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 …

Member Avatar for abc0502
0
1K
Member Avatar for vegaseat

[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) …

Member Avatar for georgooty
0
763
Member Avatar for zygimantelis

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): …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for barrelr0ll

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 …

Member Avatar for barrelr0ll
0
92
Member Avatar for doobz

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, …

Member Avatar for woooee
0
760
Member Avatar for MissAuditore

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 …

Member Avatar for vegaseat
-1
99
Member Avatar for vegaseat

This Python Tkinter GUI toolkit code draws a shape, and shows you when and where the mouse has been clicked within the shape.

2
4K
Member Avatar for sgeep

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 …

Member Avatar for TrustyTony
0
835
Member Avatar for Inshu

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 ??

Member Avatar for woooee
0
220
Member Avatar for vegaseat

There is always room for optimizing primelist functions. Here is an assortment timed with Python module timeit ...

Member Avatar for rubik-pypol
3
392
Member Avatar for Inshu

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

Member Avatar for Inshu
0
112
Member Avatar for syeda amna

I am trying to run a program from python command line. I installed python on D: drive. PLZZ help me in fixing this problem.

Member Avatar for syeda amna
1
578
Member Avatar for james5050

hi i have been trying to draw a stick figure, but i don't know how to start, pls i need a help.

Member Avatar for vegaseat
0
822
Member Avatar for ashley9210

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 = …

Member Avatar for vegaseat
0
111
Member Avatar for mickeyVeliki
Member Avatar for godcr7

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, …

Member Avatar for rhuffman8
0
867
Member Avatar for weblover

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 …

Member Avatar for weblover
0
368
Member Avatar for robert.montgomery.75054

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 …

Member Avatar for TrustyTony
0
98
Member Avatar for rhuffman8

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'] …

0
306
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
177
Member Avatar for glenwill101

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

Member Avatar for Gribouillis
0
124
Member Avatar for padton

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)] …

Member Avatar for Gribouillis
0
229
Member Avatar for robert.montgomery.75054

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 …

Member Avatar for robert.montgomery.75054
0
221
Member Avatar for nUmbdA

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 ** * * * * * * * * …

Member Avatar for snippsat
0
114
Member Avatar for glenwill101

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.

1
236
Member Avatar for elieobeid7

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 …

0
112
Member Avatar for MissAuditore

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 …

0
90
Member Avatar for ttambet

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?

0
38

The End.