15,406 Topics
![]() | |
Program For Standard Form def stnfrm(a,b,c): one = (b/(2.0*a)) two = c-((b**2.0)/(4.0*a)) axis = one/-1.0 x = -b/(2.0*a) y = a*(x**2.0)+(b*x)+c print x if a == 1: print "(x + %f)**2 + (%f)" % (one,two) elif a == -1: print "-(x + %f)**2 + (%d)" % (one,two) else: print "%d(x … | |
Ok so I'm trying to make a inter face with a password. my plan is to have a window open up with an input box where you type the password and then when you have the right password it brings you to the second screen with the stuff on it. … | |
my code tries to generate a tree for reversi/othello but it runs into an infinite while loop and i am unable to debug it.The purpose of this code is to make minmax algorithm for the aiplayer.please help. import numpy board=numpy.array([[0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,1,2,0,0,0], [0,0,0,2,1,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0]]) matrix_list=[numpy.copy(board)] points=[] decoy_list=[] … | |
I have two python script the first once contains my def callers and my command line arguments. The second one contains my defs that i want to use the command line arguments in. I was wondering if there was a way to call the command line arguments into the second … | |
I am working on s code that i want to add command line arguments to. I have read the docs.python page on this subject 3 or 4 times and it still has me conffused. I want to be able to set my base directory, change a send and recive email … | |
hello all; <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title>Our Local site</title> </head> <body> <form action="welcome.php" method="post"> <input id="t1" name="t1"type="text" placeholder="table name"><br> … | |
Using python 2.4.3 I'm trying to make a HTTP server which: (1) receives a message with 'POST', (2) makes an answer message, (3) send the answer message back to sender. Step (1) and (2) go well, Step 3 fails.... **sometimes**. It looks like there is some threading issue with the … | |
This snippet implements a pointed set, that is to say an ordinary set of elements with a distinguished element called the basepoint of the set. For example the seven days of the week could be stored in a pointed set, the basepoint being monday because today is monday. It is … | |
Hello please i need some help to rewrite this code in PHP to Python i am totally new in this and need this baddly please help if u can. Thanks a lot. <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpChart - Basic Chart</title> </head> <body> <?php function array_delete($array, … | |
I did code for challenge that I saw posted for C# by deceptikon: http://www.daniweb.com/software-development/csharp/threads/479304/coding-challenge-string-to-date Here it is. Of course normally the code would be without prints and put in function, but this is enough for now for me. There could also be normalization from '/' separated form not producing ambiguous … | |
I have a simple menu like this **HTML** <div> <ul> <li> <a href="#">Demo</a> </li> <li> <a href="#">Demo2</a> </li> <li> <a href="#">Demo3</a> </li> <li> <a href="#">Demo4</a> </li> <li> <a href="#">Demo5</a> </li> </ul> </div> **CSS** ul li:nth-child(1){border-top:4px solid red;} ul li:nth-child(2){border-top:4px solid pink;} ul li:nth-child(3){border-top:4px solid blue;} ul li:nth-child(4){border-top:4px solid orange;} Now … | |
How can I return the indexes of RBG? Say `p` is my *Numeric Python array*. >>>x = 58 >>>y = 72 >>>p[y][x] array([255, 255, 255], dtype=uint8) I don't know what a *Numeric Python array* is or how to handle them but I found how to convert it to `['255', '255', … | |
Dear friends, I'm having a strange issue with a simple python code involving wx and HTML2. It is a code to run a local html page (on windows) but when I close the browser, the process stays in memory and I have to manually kill it. Here is the code, … | |
Hi there, I am bit confused about this. I am doing assignment on neuron analysis by using python neurolab. Hidden layer Architecture 1 [9-1-1] // 9=input nodes 1=hidden nodes 1=output 1 [9-2-1] // 9="" 2=hidden nodes 1=output 1 [9-3-1] 1 [9-4-1] 1 [9-5-1] 1 [9-6-1] from the description above. I … | |
I have a python script that reads a csv file and converts it to two new files so that my database can add new emails or update existing ones. What im trying to do now is after it has converted them for it to send me a email with how … | |
Hi guys, I need your help as I got stuck. I'm trying to fetch the data from my own xml which it looks like this: <?xml version="1.0" encoding="UTF-8" ?> <tv generator-info-name="www.mysite.com/xmltv"> <channel id='101 ABC FAMILY'> <display-name>101 ABC FAMILY </display-name> <programme channel="101 ABC FAMILY" start="20140520110000" stop="20140520120000"> <title lang="en">Gilmore Girls - Let … | |
can someone help me am trying to create a game that scrambles words then you have guess the corect words for it this what i have doen so far but it dint seem to work can sometell me what the problem. import tinker import random words_list = [] f = … | |
I am working on my first project. I am trying to create a program that can fetch a string from a text file when the number for that string is entered, and allow the user to edit that string if they wish. Right now I'm just trying to get menus … | |
Using the following code as a foundation (it reddens the upper left corner of an image), I was told to create 2 different programs: one that would brighten the entire image, and one that would convert the entire image to grayscale. I need major help with this. Here's the code … | |
Challenge: change the code so that only .py and .txt files of a given directory are listed. ''' filename_list_given_dir1.py use module glob to list all the filenames of .jpg files or any extension(s) you specify in a given directory ''' import glob import os # all files (split off file … | |
Hello! I have started experimenting with GUI programming using TkInter. Up to now, I have written this code: [CODE]import Tkinter, tkFileDialog, Tkconstants from Tkinter import * root = Tk() root.title('Watermark Image Processing 1.0b') #Options for buttons button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5} #Define asking directory button dirname = … | |
Hi I am trying to write a code that finds approximations of sine and cosine using the equations below with a given value of theta in degrees basically as a novice programmer i am having trouble setting upa a while loop for the expansions. Also can you guys please quote … | |
Hi everyone, I have 4 .py files : main.py , file1.py , file2.py , file3.py as : main.py: import sys import file1 import file2 import file3 def main(a,b): c=file1.somme(a,b) d=file2.mul(a,b) file3.div(a,b) print c,d if __name__ == '__main__': a,b=sys.argv[1:] a=int(a) b=int(b) main(a,b) file1.py: def somme(i1,i2): return i1+i2 file2.py: def mul(i1,i2): return … | |
I am looking for alternatives to setup a server in work place which does not allow to setup new software to computers to check and reserve rooms for meetings both through local network computers or possible from home / on the move. I of course would like to have thy … | |
http://pastebin.com/piCzf2sT when put a token in vertical that the main windows is full appear all the line in selected color and not only one, anyone can know why? | |
I am new to programming and I am looking for a language that is easy to learn, and a relatively useful programming language. I don't know much about programming but I want to learn and I think here is the best place to start. I want to get started on … | |
To continue[ my quiz series](http://www.daniweb.com/search/query/0?q=%22quiz+of+the%22+pytony#gsc.tab=0&gsc.q=%22quiz%20of%20the%22%20pytony&gsc.page=1), explain what happens with this code (how you would name this action and is there other way to get same result), why, and what is actually the value of `a` at end. a = ['a', 'b','e'] a[2:2] = ['c', 'd'] | |
This small script named `sourcecode.py` is a command line tool to open a python module's source file with the default editor. For example the line $ python sourcecode.py xml.dom.minidom opens the file minidom.py from the python distribution with the default editor. The same works with user-defined modules having a python … | |
so this project is basically nothing more than a python to GLSL translator. https://github.com/ncbray/pystream you have to follow the GLSL rules with the python code, so usage isn't exactly free. the problem though is Nick Bray only documented a little about how to code the shaders, and gives no examples … | |
Hi everyone, I'm new to programming (and daniweb) and I'm having a small problem with a Caeser Cipher program I'm writing. messageE = input('\nPlease enter string to encrypt: ') offsetE = int(input('Please enter offset value (1 to 94): ')) encryptedE = '' if offsetE < 1 or offsetE > 94: … | |
hi guys.. im new to this forum and im certain its here that all my problems will be solved. In fact I have a traffic simulation project in python. Im stuck at the very start since ive never programmed in python. I would like to know how to make an … | |
http://pastebin.com/embed_js.php?i=TpzkKkYW Here's what I have right now. I am basing it off this ( http://forum.codecall.net/topic/76208-tkinter-ball-snake-game/ ) and trying to change it into what I want, as I'm fairly new to python and wasn't sure how else to start. Could you guys help me make it more simple? I just want … | |
hello python developers, i recently started working on a simple xml rpc application, the simple version is completly working but when i wanted to extend it and add some more functionality i ran into some troubles. i want to register functions from different classes as server methods, i thought i … | |
This snippet shows how to find the complex roots of a polynomial using python (tested with python 2.6). You need the scipy or numpy module. | |
my code has this structure class Mapsframe(wx.Frame): def __init__(self): import application class Example(wx.Frame,listmix.ColumnSorterMixin): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI() def InitUI(self): def onItemSelected(self,event): frame = Mapsframe() and i need to pass two variables which have been created localy inside the def onItemSelected to another python script called application.py … | |
after importing pygame, when we convert an image an assign it to a variable, what is the type of that variable? | |
Hello. I am a complete newbit to Python. I am trying to read a text file (which is actually an svg file) and add a line to the text file. I would also like to remove certain text from the file. I am trying to edit some of the tags … | |
Hi there, Guys I need help in understanding the this code. Because I have been asked my lecturer to use the existing code and propose a problem through any journals which have connection with neural network and demonstrate it using the codes. Before selecting any journal, first I need to … | |
This script computes the formal series expansion of a mathematical function on the command line using the python module swiginac, an interface to the CAS Ginac. Typical invocation in a linux terminal looks like $ serexp.py -n 7 "log(1+x)*(1+x+x**2)**(-1)" 1*x+(-3/2)*x**2+5/6*x**3+5/12*x**4+(-21/20)*x**5+7/15*x**6+Order(x**7) As far as I know, swiginac does not work in … | |
i have this code import wx import datetime,re,os,time,urllib,errno import sys import wx.lib.mixins.listctrl as listmix musicdata = { 0 : ("Bad English", "The Price Of Love", "Rock"), 1 : ("DNA featuring Suzanne Vega", "Tom's Diner", "Rock"), 2 : ("George Michael", "Praying For Time", "Rock"), 3 : ("Gloria Estefan", "Here We Are", … | |
What I am trying to acheive is to parse an xml file break it up into useful components and push it to a multi table SQL database. But I cannot get off the ground in the basics. Take an xml file like this [Click Here](http://old.racingnsw.com.au/Site/_content/racebooks/20140513HAWK0.xml) Which at the start is … | |
I [saw interesting problem](http://www.daniweb.com/software-development/legacy-languages/threads/478323/prolog) of generating spiral of numbers and realized I could reuse [my code for rotation](http://www.daniweb.com/software-development/python/code/371536/rotate-sequences-left-or-right) I posted earlier. | |
initialize passes to zero initialize failures to zero initialize student to one while student counter is less than or equal to ten input the next exam result if the student passed add one to passes else add one to failures add one to student counter print the number of passes … | |
Is there any way i can use pygame and Tkinter in python together? I was planning to make a game using both of these modules.i'm trying to make the window and option buttons using Tkinter. the options would let the user choose which game s/he wants to play. then after … | |
I have a csv script that runs within a sequence on a set of gathered urls like so: threaded(urls, write_csv, num_threads=5). The script writes to the csv but seems to rewrite the first row for each url rather than writing to new rows for each subsequent url. I'm new to … | |
A simple way to resize an image programmatically, using the PythonMagick module. This module is a python port of the [the magick++ library](http://www.imagemagick.org/Magick++/). | |
Hi I would like to use randint from random to get random numbers, and after doing this I would like to add it to Dict or List and check if the number already added and which Postions this an have so it shoudl print out which possition this number have, … | |
Hi, I'm new to Python and have a task of reading a user input text file that is tab-delimited and contains 4 columns in each line: Authors, Year, Title and Journal. I currently am just able to open a file, and now I don't know how to begin parsing the … | |
Hello, Simple question: how can I command pgs4a to use android-10 (2.2.3) instead of always using android-8 (2.2)? I've tried using the target commands, but to no avail, unless I have missing files? I have my game set up and built, i've successfully created 2.2 apk's but cannot figure out … | |
#QUESTION ONE person = input('Please enter your name:') print('Hello', person,'. How are you today?') #QUESTION TWO emotion = input('Please enter happy, sad or neither:') if emotion == 'happy': print('Well, it is great to hear that you are so chipper',person,'! Shall we continue?') else: print('Sorry to hear that. Hopefully we can … |
The End.