15,190 Topics

Member Avatar for
Member Avatar for SK6114

Hi, I need to integrate e^-(x^2) between negative infinity and positive infinity, now the function vanishes to a minute value much before negative and positive infinity. I need to approximate the integral using the trapezium rule, which I have coding for but I just don't know how to apply it …

Member Avatar for TrustyTony
0
744
Member Avatar for pelin

i am writing a program that reads the file i create. The file has grades and weights of grades anddd 3 person but i need to create a program that will read the information from the file, calculate and print the total average of each student given by the formula …

Member Avatar for TrustyTony
0
233
Member Avatar for eikonal

Hi everyone! This is my first post even though Ive been reading you for a while. I'm a Python beginner and I'd need your help. I'm processing a very big file (more than 2 millions of lines) but I'll show you a much smaller example (24 lines rather than 74513). …

Member Avatar for JoshuaBurleson
0
130
Member Avatar for PlUmPaSsChIcKeN

Im a beginner to python and my professor has assigned the following assignment: You buy an international calling card to India. The calling card company has some special offers. a) If you charge your card with $5 or $10, you don’t get anything extra b) For a $25 charge, you …

Member Avatar for PlUmPaSsChIcKeN
0
238
Member Avatar for momus

How to suppress end user ability to edit/add/delete text in a Text widget? (Python v3.2.. and tkinter) The point is to [B]suppress only the ability to change/add/delete text[/B] but not to castrate other features. Perhaps a NoEdit Text widged would be a better name. I've tried [B].text['state'] = 'disabled'[/B] and …

Member Avatar for momus
-1
1K
Member Avatar for peste19

[CODE] for elem in sentence: .setdefault(elem, 0) repeat[elem] += 1 print sorted([ (freq,elem) for elem, freq in repeat.items()],reverse=True)[:3] print repeat [/CODE] i have this loop which analyses the elements in the loop and then prints by frequency, i wanted to print by frequency and alphabetically. example [(5,apple),(5,orange)]

Member Avatar for woooee
0
1K
Member Avatar for JoshuaBurleson

I'm trying to use cx_Freeze and everything everything seems like it should work fine, however I'm getting an import error for import tkinter [CODE]Traceback #... from tkinter import __fix #... import_tkinter ImportError: DLL load failed: The specified module could not be found.[/CODE] This only happens when I take the the …

Member Avatar for JoshuaBurleson
0
350
Member Avatar for Wilha

im trying to write a code that i can input a,b,c and the code will run it in the quadratic formula and give me the answer but i keep getting a error problem import math from math import sqrt print print ("Welcome to the Quadratic Program") print ("--------------------------------") print a=input("Enter …

Member Avatar for Wilha
0
372
Member Avatar for born316

hii I am trying to develop a simple image browser.this is wat i have done so far [CODE]from Tkinter import * top=Tk() def search(): global pic global photo pic=PhotoImage(file='images\\pic.gif') photo=w.create_image(250,200,image=pic) w=Canvas(top,height=500,width=500,bg="white") entry=Entry(top,bg="white") nxt=Button(top,text="next",activebackground="blue",command=next) prev=Button(top,text="prev",activebackground="blue") b=Button(top,text="search",activebackground="blue",command=search) b.pack() entry.pack() nxt.pack(side=RIGHT) prev.pack(side=LEFT) w.pack() top.mainloop() [/CODE] as u can see it will display a …

Member Avatar for Netcode
0
772
Member Avatar for Y DIY

I have a question about fnmatch function. Can fnmatch take a list return from a function for the pattern? Consider the following code. [CODE] import os import sys import time import fnmatch import shutil from logalert import log def copyLiveToPrompt(): #This function will copy all of the appropriate Voice Prompt …

Member Avatar for Y DIY
0
68
Member Avatar for terry35

When I open python I am unable write my code in it. This just started to happen no idea what is happening? Its unclickable inside but I can click the bar on top. Anybody know?

Member Avatar for JoshuaBurleson
0
115
Member Avatar for soccermiles

I would like to embed the python interpreter, but not in the way most other people do. I don't need to multi-thread unless it's necessary to do as follows... What I need is control over when execution happens. More specifically, I would like to use a python script to call …

Member Avatar for soccermiles
0
265
Member Avatar for radiumc

Hello, I am very new to python. I have two files containing multiple lines of files name, and I need to filter out if file name present on file1 than remove it from file2 and save the file2 difference into a third file. i.e. file1: /users/ux454500/radpres.tar /paci/ucb/ux453039/source/amr.12.20.2002.tar~ /paci/ucb/ux453039/source/amr.1.25.2003.htar.idx /paci/ucb/ux453039/source/amr.1.18.2003.htar.idx file2: …

Member Avatar for radiumc
0
145
Member Avatar for peste19

i am beginning to learn python so please be easy on me, i am trying to create a function that will accept user input and store it in a list, separating words and ignoring punctuation example: input = i.am/lost stores in list as "[i],[am][lost]" this is what i got so …

Member Avatar for TrustyTony
0
177
Member Avatar for pythondaniweb

Say I have a string of arbitrary letters and spaces. "fdgdfg asd fasdf asdf awpoemp poanew awe pon pqonw aknlkn ar glknlk and so on" is there any way to wrap this WITHOUT using the worp wrap feature so that there are only x characters in each line? "fdgdfg asd …

Member Avatar for woooee
0
113
Member Avatar for jonjacob_33_0

Write and test a function to meet this specification: squareEach(nums) nums is a LIST of numbers. Modifies the list by squaring each entry. [CODE]def squareEach(nums): for number in nums: number = number ** 2 return number def main(): nums = [3,4] print(squareEach(nums)) main()[/CODE] The output in this case is 9... …

Member Avatar for TrustyTony
0
2K
Member Avatar for bonyjohn

hi am an btech CS student. I need some ideas for my main project.. need help donno where to start..guyz plz help

Member Avatar for TrustyTony
-1
147
Member Avatar for giancan

Dear ALL, I have a similar problem with a string/replacement 132435 321350 35465162 6561516 546516 654613 65462133 6584652 and so on for some hundreds (!!) raws. What is the best way to edit this textfile to have something like this? 132435,-321350,35465162,-6561516 546516,-654613,65462133,-6584652 Basically, I have to change the 'double space' …

Member Avatar for giancan
0
138
Member Avatar for sainitin

Hi all, I have two text files file1 1234 13454 93837 82739 . . . File2 comp i 93837 -4.52 82739 -2.2 1234 -2.36 13454 -2.25 I tried a python script to compare files and it should ideally do following search CID from file1 in file2 and append i value …

Member Avatar for Gribouillis
0
165
Member Avatar for <LDJ>

Hey guys, new to the forum, but am in need of some help. I am quite new to Python, but want to be able to program a simple script that basically does three things: -1. Finds a string of text in an .xml file (the length of the string, and …

Member Avatar for JoshuaBurleson
0
528
Member Avatar for jonjacob_33_0

[CODE]def toNumbers(strList): for char in strList: return strList[0:len(char)] def main(): sttr = ['120','125'] print(toNumbers(sttr)) main() [/CODE] The output is: ['120','125'] I want the output to read: 120 125 <-- without the brackets and quotes I'm supposed to take a list of numbers (as strings) and simply return the same numbers …

Member Avatar for JoshuaBurleson
0
818
Member Avatar for sofia85

Hi, I'm a beginner at python and I'm trying to extract a specific column from a txt file. In the file I want to extract the entire column pph2_prob (i.e. column 16). But I want to get all the values from that column without the headline pph2_prob. How do I …

Member Avatar for JoshuaBurleson
0
4K
Member Avatar for Y DIY

I would like to know how to use a list contain with file names returned from a function to search a directory based on that list then copy the matching files to another directory. Following is what I would like to accomplish in logical order. 1. Existing Function getPromptList() return …

Member Avatar for Y DIY
0
3K
Member Avatar for felix001

What is the best way to invoke the os.system command and assign it to a variable without printing the output ? Example : [CODE]ifName = os.system('snmpwalk -v 1 -c <community> %s ifName.%s' % (switch,port))[/CODE] Also with the output of the snmpwalk I will be wanting to only assign the last …

Member Avatar for felix001
0
382
Member Avatar for kaskoraja

Hi everyone, I have a huge data file and it goes on like this. [CODE] 62813, 61344, 68229, 68234, 61349, 61345, 68230 62814, 61345, 68230, 68235, 61350, 61346, 68231 62815, 61346, 68231, 68236, 61351, 61347, 68232 62816, 61347, 68232, 68237, 61352, 51631, 51573 *ELEMENT,TYPE=S4,ELSET=one 62817, 1, 2, 4, 3 62818, …

Member Avatar for TrustyTony
0
152
Member Avatar for Bosterk
Member Avatar for richieking
0
93
Member Avatar for Tourbillion

I know I just listed an earlier problem I had with the encoder program, but now I am having trouble placing the decoding formula into the decoding program. In the program you will see that I have the normal decoder for the ASCII characters in there. everytime I try to …

Member Avatar for TrustyTony
0
130
Member Avatar for pelin

i am making winter greeting card using grahics.py and i need to create a code to make it snow import random random.randint(0,199) p = Point(random.randint(0,199),random.randint(0,199)) p.setFill('white') p.draw(win) so far that what i have but noting really happened please help ! thanks !

Member Avatar for richieking
0
111
Member Avatar for Tourbillion

I am trying to do this simple encoding program for class. It is supposed to encode it using the ASCII chart and some slight modding of the number. Then it should be written to a file 'encryptedmessage.txt' for later reading by a decoder later. My issue is I dont know …

Member Avatar for TrustyTony
0
261
Member Avatar for Jburton881

Im working on python and I need to write a program to see if a number N is prime. I also need it to be able to check whether the number is even, and then, check whether the number is divisible by an odd number between 3 and &radic&N. Im …

Member Avatar for TrustyTony
0
106

The End.