15,406 Topics

Member Avatar for
Member Avatar for thehivetyrant

wow it's me again! i have: [code] i=0 while i<11: print i, print '' i=i+1[/code] this gives the answer: 0 1 2 3 4 5 6 7 8 9 10 i need to give the answer. * * * * * * * * * * * * * * …

Member Avatar for thehivetyrant
0
103
Member Avatar for strobon

hello everybody...have trouble with pygtk and glade. iam working on a simple form with purpose to explain simple ubuntu command like (gnome-terminal,nautilus,gedit) to newbie user. Might be easier if i attached the form... [ATTACH]9758[/ATTACH] the cellrenderertext is working properly (when i click every row it should explain the description in …

0
62
Member Avatar for harrykokil

how can i create 50 apples at different positions on screen without having to each time call the constructor 50 times? [icode] import Tkinter as tk from Tkinter import * import time class Apple(object): def __init__(self, a,b,c,d): self.rect = canvas.create_oval(a,b,c,d) root=tk.Tk() canvas = tk.Canvas(root, width=300, height=300, bg="#FFFFFF") canvas.pack() for x …

Member Avatar for lllllIllIlllI
0
150
Member Avatar for demeryjo

Hey, so for a project of mine we are asked to draw a face using instances of classes. I'm not very familiar with classes and I was wondering if anyone could explain to me why my code wont even open the turtle window. I'm also slightly confused as to how …

Member Avatar for lllllIllIlllI
0
90
Member Avatar for rampalli.sarma

Dear friends, Greetings I am copying the code which is giving only one error. Please help. I have attached the file also.. cross.py [code] import subprocess, sys, socket, time, struct, random from traciControl import initTraCI, simStep, close, getVehNoOfIndLoop, setPhase PORT = 8813 NSGREEN = ["0101", "0101", "0000"] NSYELLOW = ["0000", …

0
48
Member Avatar for artemis_f

Hi I am beginning to learn wxPython a little with the "wxPython in Action" book but I haven't managed to figure out this one thing I really want to do and am hoping someone can help me. I want to do something like create an Ellipse to which I can …

Member Avatar for artemis_f
0
351
Member Avatar for skhan23

All questions involve this portion of a program: [CODE] if (y>x and y<z)or(y<x and y>z): print("You have entered Condition 1") elif not(x!=y and y!=z): print ("You have entered Condition 2") else: print ("You have entered Condition 3")[/CODE] 1. If x = 10 and y = 10, what is the value …

Member Avatar for adam1122
0
102
Member Avatar for leegeorg07

this relates to _nestors problem but im trying to expand it on my own i have this code: [code=python] logfile = open("logfile.txt", "r").readlines() KEYWORDS = ['test', 'text'] counterline = [] counter = 0 for line in logfile: for word in line.split(): counter+=1 if word in KEYWORDS: counterline.append(counter) print word print …

Member Avatar for woooee
0
115
Member Avatar for lowbot

Is there a way to script a broadcast packet send? Im doing some network traffic and would love to be able to see if my broadcasts are getting through. Or alternatives if python isnt the best/easiest way to do this. XPSP2 if it matters. Thanks.

0
42
Member Avatar for mafarooqi

Hi everyone, I have been working with Matlab but now I have to develop a couple of programs in Python. So I am new to Python. Could anyone tell me the python equivalent of [B]eval [/B]command of Matlab. Actually I have to open a set of say 100 files to …

Member Avatar for mafarooqi
0
460
Member Avatar for MartinIT2type

Hello again! I've started a game project for fun, and I used the knowledge I gained a few days ago from a thread I posted. Now I've taken that tried to take that (taking a text Entry out of a GUI and using it outside the class) and apply it …

Member Avatar for MartinIT2type
0
2K
Member Avatar for tech12

This is a project I'm working on for a class. I'm pretty new to CS and python...and I found that I am totally lost. I'm suppose to write a program to convert Roman numerals to arabic numbers. It is also suppose to handle invalid input. Here is what I have …

Member Avatar for woooee
0
177
Member Avatar for thehivetyrant

I am trying to: [B]Implement an iterative Python function which returns the sum of the first n integers[/B] so far i have this: [code] i = 0 total = 0 def sum(n): while i <> n: total = total + 1; i = i + 1; return total [/code] then …

Member Avatar for scru
0
92
Member Avatar for gotm

[code=python]#!/usr/local/bin/python #Scott Landau #CS 380 #Assignment 1 Programming Portion in Python #Created - 4/6/09 #Last Edited - 4/7/09 #n is going to be equal to 4 for this queens problem. n = 4 #Assigning the empty list to initialState. initialState = [] #Making an allDirections list. allDirections = [[-1,0],[1,0],[0,-1],[0,1],[-1,-1],[-1,1],[1,-1],[1,1]] #declare …

Member Avatar for woooee
0
124
Member Avatar for Rick3414

I am pulling a name, address, phone number from a text file. The items are delimited with a comma. I pull them into a variable. How can I pull them in or parse them out? I'm not sure if this is a tuple or a list or what, but when …

Member Avatar for vegaseat
0
118
Member Avatar for mangotango

I am constructing some sort of a status bar which allows the user to update their status while in a social network. It consists of an entry field and a 'update' button beside it. What I hope to do is upon activation of the button 'update' the contents in status …

Member Avatar for sneekula
0
857
Member Avatar for aegis042404

Hi, I'm writing a small app in wxpython, on a linux box. I just want to display a graphic and play a short ogg when a gui button is clicked. Started out as a memory card game, now I just want to display the graphic and play a sound when …

Member Avatar for lllllIllIlllI
0
362
Member Avatar for amitattri1987

I'm making a small web application in python. Transferring control from one python page to another can be done by form submit or onclick button.This happens at an event. But I'm searching for a functionality in python similar to 'server.transfer' in asp which is not event dependent. Please Help.

Member Avatar for adam1122
0
121
Member Avatar for thehivetyrant

Hello there, I've a homework assignment from a while ago that asks [B]"Implement a recursive Python function which returns the sum of the first n integers"[/B] Now i just dont know exactly what it's asking and how to get started. Recursive functions, right (my thoughts so far is it'll look …

Member Avatar for thehivetyrant
0
127
Member Avatar for srk619

need help on this question: Write a lexer to read in decimal numbers. If your input is the following string: “12345.9876” what do you have to do to each character in the string to generate your float? How are the numbers before the decimal point different to the numbers after …

Member Avatar for srk619
0
160
Member Avatar for gotm

[code=python]#!/usr/local/bin/python #Scott Landau #CS 380 #Assignment 1 Programming Portion in Python #Created - 4/6/09 #Last Edited - 4/7/09 #n is going to be equal to 4 for this queens problem. n = 4 #Assigning the empty list to initialState. initialState = [] #Making an allDirections list. allDirections = [[-1,0],[1,0],[0,-1],[0,1],[-1,-1],[-1,1],[1,-1],[1,1]] #declare …

Member Avatar for woooee
0
96
Member Avatar for mg0959

Hey guys, I have a python script that I need to run on a windows machine when the computer boots up but before a user logs in. It is the server side of server/client program. The program needs to be able to write and read files, as the server program …

Member Avatar for mg0959
0
160
Member Avatar for JeyC

All, I am using a python script (v2.0) to call a batch file. 1. The python script should wait until the batch file is finished. (So that rules out os.startfile, os.popen etc.) 2. For unknown reason, os.system does not work ... So I am using os.spawnv(os.P_WAIT,BatchFile, BatchFile) where Batchfile =r"E:\..... …

Member Avatar for woooee
0
119
Member Avatar for Malestryx

Good evening everyone, I am once again posting a question. My school project is done. And I appreciate all the help you gave me. The following code is a working program. The only thing I have absolutely no real good idea to do is calculate the Overtime Rate with my …

Member Avatar for woooee
0
1K
Member Avatar for srk619
Member Avatar for srk619
0
173
Member Avatar for Hatz2619

Sorry guys, I'm a rookie at the whole Python thing so please forgive me if the following questions are easily answered. I'm working on my final project for class and I'm just stuck. I have no clue what's going on with this program. It isn't running properly in IDLE at …

Member Avatar for Hatz2619
0
925
Member Avatar for dmpop

Hello, I'm not a programmer, so please bear with me. I'm using the following script with Python 2.6 to send emails with attachments from the command line. [CODE]#!/usr/bin/python import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders import os import sys …

Member Avatar for vegaseat
1
146
Member Avatar for Malestryx

Good afternoon, I am currently working on a payroll program for school. I have a question. Here is my code. [ICODE] #Mainline def employee(): global eName global pRate global hWork def Lowest(hoursList): PAYList.sort() lowestPay = hoursList[0] return lowestPay def Highest(hoursList): hoursList.sort() highestPay=hoursList[len(hoursList)-1] return highestPay def Average(hoursList): total=0 for hour in …

Member Avatar for Malestryx
0
167
Member Avatar for Malestryx

Good evening, I am having difficulties figuring how to get my calculations working. Basically, I want my hours to actually be what is typed in under each question, but they are all ones. I could use some help [ICODE] def Employee(): global eName global pRate global hWork def Low(hoursList): hoursList.sort() …

Member Avatar for leegeorg07
0
99
Member Avatar for gabec94

Hi I am trying to write a function [I]password_input(prompt, password)[/I] that will repeatedly ask for a password using the given prompt until the given password is entered. I have testing code, but I am completely lost upon how to do it and where to begin. This is the testing code: …

Member Avatar for Flameass
0
119
Member Avatar for miller4bears6

[B]hey yall[/B] I've been working on this python program for a while and I need some help please. This program consists of classes and functions to make a basic maze. I'm not using Tkinter or any gui's. Just a printout where python does all the calculating. I have three files, …

Member Avatar for jlm699
0
185
Member Avatar for murnshaw

Sorry for the noobish question, but I'm trying to write a function that accepts strings as inputs. Here's what I've got: def backwards(x): word = "x" index = 1 while index < len(word)+1: letter = word[-index] print letter index = index + 1 Whenever I call the function, such as …

Member Avatar for Arrorn
0
1K
Member Avatar for toadzky

I am writing a ping app for my networking class. I have the ping part of the code working perfectly, my issue is in shutting down my "ping" server. If I run it with while True, not even ctrl-C will shut it down till the next ping request. I can …

Member Avatar for vidaj
0
189
Member Avatar for currupipi

Hello everyone! :) I would like to read a xml file in order to return the content as a HTML response. I wonder if i need to parse the XML file or i can read the file as if it were an txt file. I am interested in this second …

Member Avatar for currupipi
0
118
Member Avatar for srk619

can some help me with my film databse code which is below, i need to know how can i allow a single film to be displayed by index and how can i allow a film to be removed by index anyone have any ideas [ICODE][/ICODE] #A list of entries 2 …

Member Avatar for srk619
0
101
Member Avatar for srk619

hey im finding this question quite hard to do can anyone help out. Implement an iterative Python function to generate numbers in the Fibonacci sequence: fib(0) = 1 fib(1) = 1 fib(n) = fib(n − 1) + fib(n − 2)

Member Avatar for srk619
0
146
Member Avatar for dhvl2712

I wrote a simple .py program for [code="python"] def main(): print ("Hello World") [/code] That's it. I saved it as hello.py But when i try to run it I get this error: [code="python"] >>> hello.py Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> hello.py NameError: name 'hello' …

Member Avatar for leegeorg07
0
527
Member Avatar for smcp

So I'm basically completely screwed at the moment. I'm enrolled in a higher level course at my school (an Artificial Intelligence class) despite the fact that I'm new to my major (computer science) and have very little programming experience (just C++, that's all). I was just wondering, has anyone around …

Member Avatar for adam1122
0
107
Member Avatar for tomtetlaw

this is my code: [code=python] #!/usr/bin/env python #==========================================# # Copyright Tom Tetlaw & Shadwick (c) 2009 # #==========================================# import pickle as pk from formatting import * from gclasses import * from gfuncs import * from items import * from objs import * class Actor(object): def __init__(self, name, age, race, profession): …

0
57
Member Avatar for BlueNN

I'm trying to get my little user-input program to recognize that words aren't numbers. Without any logic parameters the program just crashes when you put in anything but a number, I'm attempting to allow the user to try again and put in a number using a while loop, but I …

Member Avatar for adam1122
0
114
Member Avatar for MaQleod

I'm fairly new to python and object oriented programming in general, so I'm having a little trouble figuring out why this doesn't work this is the error I'm getting for the code below: Error: 'str' object has no attribute 'insert' [CODE]filetolist = FileReadToList("test.txt") print filetolist[0] def FileCountLines(s_filename): f = open(s_filename) …

Member Avatar for MaQleod
0
7K
Member Avatar for BlueNN

I've just started in Python and I'm still feeling my way around, I tried to create a quick program to display "Welcome to Python!" without the quotes. The entirety of the code is this: [code]print('Welcome to Python!')[/code] However, when I double-click on the .py file Python opens up for less …

Member Avatar for BlueNN
0
145
Member Avatar for henryxxll

Hey guys: I'm trying to write a python script to execute a Linux program, with several arguments set by the user, like so: [CODE=python] import os variable_input=int(input("Input Number Argument: ")) os.system("/path/to/program"," -argument1 ",variable_input) [/CODE] However, the os.system() command doesn't allow more than one input, so I tried this: [CODE=python] import …

Member Avatar for henryxxll
0
3K
Member Avatar for tlinux

I have several programs written for Python 2.6. When I downloaded Python 3.0 the programs wouldn't run. I'd like to have both versions on my computer and be able to run my 2.6 programs by default. Then, for new programs, I'd like to switch to 3.0. How can I do …

Member Avatar for scru
1
387
Member Avatar for MattDan

Hi, I'm trying to write a program that monitor Internet Explorer events - creating/deletion of the process, loading pages, creating tabs etc. I managed to monitor creation/deletion by using WMI, but I couldn't find a way to monitor the rest of the events. Is there a way to do this? …

0
39
Member Avatar for tomtetlaw

my inheritence isnt working, it says saveAttributes isnt defined: [code=python]#!/usr/bin/env python #==========================================# # Copyright Tom Tetlaw & Shadwick (c) 2009 # #==========================================# import pickle as pk from formatting import * from locations import * from gclasses import * from gfuncs import * from items import * from objs import * …

Member Avatar for tomtetlaw
0
81
Member Avatar for tomtetlaw

i made a file reader but it always returns corrupted: [code=python] def load(charactor): fout = open(charactor + '.actor', 'r') fout.seek(0) actor_type = None attrs = [] for index, line in enumerate(fout.readlines()): if index == 0: actor_type = line.replace('{', "").strip() if index == 1: if line == 'attributes': if not line …

Member Avatar for tomtetlaw
0
86
Member Avatar for tomtetlaw

can someone give me a tut on how to read files like this: [code]charactor { name = "name" race = "human" ## ect.. }[/code] any and all help will be appreciated :)

Member Avatar for lllllIllIlllI
0
71
Member Avatar for akhileus87

Hy all, Firstly sorry for my English. I do one school project where I need to open one app with web page, what is generated with python. This process or app will make calclulation and create models. I created .bat to open this app: C:\\OpenModelica1.4.3\\bin\\omc +d=interactivCorba This works fine, but …

Member Avatar for akhileus87
0
124
Member Avatar for Malestryx

Good afternoon, I have posted a similar question before. I am a Python Newbie. But, I really need some code help here. I am writing a payroll program. Here is my code: [ICODE] employee=[] eName="Employee" pRate="Payrate" hWork="Weekly Hours" while (eName, pRate, hWork)>0: eName=raw_input("\nEnter the employees' first and last name. ") …

Member Avatar for Malestryx
0
108

The End.