15,185 Topics
| |
I tried to find the square root of a negative number while writing a function to solve quadratic equations but the interpreter said something , it said math domain error, what does this mean. Even though I've been able to solve the quadratic equation using complex numbers and i will … | |
Hi all, I have the following script for creating scatter plots and I was wondering if there is a way of adding the legends also for each dot in the plot (i.e. Method1, Method2 etc) [code] #!/usr/bin/env python import sys,re,os; import matplotlib as mpl; import matplotlib.pyplot as plt; datafile = … | |
I've been looking for an exercise book for Python, a book that we get some stuff to code, like ideas, and etc. I have already finished the "Invent your own computer games with Python". Is there any other book? Thanks in advance. | |
I want to open a process in the background and it should be invisible in both Linux and Windows. I made something like this, but I don't know the console still appears on the screen: [code] command = "cmd /C dir c:\\" startupinfo = None if os.name == 'nt': startupinfo … | |
I just recently (one week ago) started learning Pyton. I'm using 2.7 as I heard that is best for begginers. I am also following a manual, which is really helpful! The one problem with manuals is that it's very easy to just type whats written and not understand it at … | |
Well just run, the only thing is that this is created using python 3.x. no modules required. | |
Is python 3.2 stable yet, because i use portable python v1.1py3.0.1, so far I'm making improvement, but I have problems loading modules, how do I go about it. | |
Please i just downloaded the latest version of pygame, but I've been finding it difficult to install, okay when i unpacked it, everything came up, but i don't know which should go to which. Python experts in the house what do i do. | |
I'm trying to create a vertical histogram using only built-in modules. I understand the current histogram function isn't truly a histogram (and the code is probably very ugly), but I'm totally lost on how to create a vertical histogram. [CODE]import itertools def histogram(s): print("Histogram:") print("%s %7s %12s" % ( "No.", … | |
[CODE]def main(): i=input() print(i+1)[/CODE] (I use PYTHON 3.2) Why i get an error converting message ? | |
Hi guys this is my very first python program I've been trying to use re.match to test to see if a string is an identifier as defined by this syntax [CODE]identifier -> letter{ letter| digit}[/CODE] I tried the following statements but when i test my program every single time it … | |
Hello all I'm having a few issues with a Python program in that I am performing decimal calculations on and most values come up as desired, however every so often, when there is a very small decimal, the number is represented like "6.80E-7" rather than the desired "0.000000680". Here's a … | |
i am currently running Mac OS 10.5 and i have written and fully debugged (nothing in the command line) a large python script. i am wondering how am i able to create an app for the program. i do not understand the lingo of how to install different libraries and … | |
[CODE]from Tkinter import * master = Tk() def ChangeOpt1(): Options.option_clear() Options.option_add("Apple","Orange","Melon") Options.update() def ChangeOpt2(): Options.option_clear() Options.option_add("Milk","Water","Juice") Options.update() Option1=Checkbutton(text="OPTION1",indicatoron=0,command=ChangeOpt1) Option1.pack() Option2=Checkbutton(text="OPTION2",indicatoron=0,command=ChangeOpt2) Option2.pack() variable = StringVar(master) variable.set("You have to check an option") Options= OptionMenu(master, variable, "You have to check an option") Options.pack() mainloop()[/CODE] I want to do that when I clicked Option1, … | |
Hi DW, I'm extremely new to DaniWeb. I have been coding in C++ for about one month. I'm thinking about coding in Python too. But, I'd like to ask some newbie question's about it first. [B]I'd like to know what it's used for.[/B] [I]I think it's mostly used for web … | |
[CODE]#this function checks if a number is a prime number, #if not it outputs the lowest factor. def isprime(n): """Determines whether a number is a Prime number, Takes a single arguement n, which is the number""" if n==1: return 'Not a Prime number, only has one distinct factor' elif n==2: … | |
I have this code: [CODE]protein="GWEIQPYVWDECYRVFYEQLNEEHKKIFKGIFDCIRDNSAPNLATLVRVTTNHFTHEQAMMDAVKFSEVLPHKKMHRDFLEKLGGLSAPVDNHIKGTDFKYKGKAKNVDYCKEWLVL" pp="LLCCCCCCCCCCCCCCCCCCHHHHHHHHHHHHHHHHHCHHHHHHHHHHHHHHCCCCHHHHHHHCLLLCCCCCHHHHHHHHHHHHHHHHHHHCCCCCCCCCCCHHHHHHHHHHHHCCL" gor="cccccccccccchhhhhhhhhhhhhhhhhhhhhhhccccccccceeeeecccccchhhhhhhhhhhcccchhhhhhhhhhhhhccccccccccccccccccccccceeceeccceec" aber="CCCCCCCCCCCCHHHHHHHCCHHHCHHHHHHHHHHCCCCHHHHHHHHHHHCCCCCCHHHHHHHCCCCCCCHCCHHHHHHHHHHCCCCCCCCCCCCCCCCCCCCCCCCCHHHHHHHCC" for i in range(len(protein)): print i+1,protein[i], pp[i], gor[i], aber[i] [/CODE] I'm trying to compare these strings. However, the output is in a vertical format. How can I print it so that the format is vertical? This would make it much easier to … | |
This is a program that can calculate, the GPA of a student on a 5.0 scale,it's written in python 3.x and no modules are required. | |
i am tryin to create an app that should make my cellphone work as a webcam ... there are softwres like smart cam for that... also there is an app like mycam that lets you use a gif and create a vistual cam ... i want to know how an … | |
| I had recently made a .bat file that read a couple lines from file.txt and assigned them as variables then went through the execution of the bat which ended up deleting the original file.txt and writing the new values to a new file.txt. Now I want to convert this to … |
I am currently having problems displaying a file correctly once i have written a dictionary to the file. For this program the input file needs to have the format: ID: Date: Dayskept: ProductName e.g. 1:12/12/2011:12:A This is fine the first time I read the example file into a dictionary, but … | |
hi, am trying to parse a multiple pairwise format into table for example: Query= m100529_140129_SMRT1_c0000010190006406181231110_s0_p0/32965/0_332_clipped_50:0 (282 letters) Query: 8 TTTTTGAACAGCCCCAACAACTCTTCCGCTGCCGGTTGCTGCA-TTCCAGTTGTTCCACA 66 ||||||||||||||||||||||||||||||||||||||||||| |||||||||||| ||| Sbjct: 4045830 TTTTTGAACAGCCCCAACAACTCTTCCGCTGCCGGTTGCTGCACTTCCAGTTGTTC-ACA 4045772 Query: 67 GTCCAGCTCCAGTTCAACGTCGGTTTAAATCGTCG--AGCT-GTATGAGAGATAAGCATA 123 | ||||||||||||||||||||||| |||||||| |||| |||||||||||||||| | Sbjct: 4045771 GGTCAGCTCCAGTTCAACGTCGGTTTTAATCGTCGCCAGCTGGTATGAGAGATAAGCA-A 4045713 Query= m100529_140129_SMRT1_c0000010190006406181231110_s0_p0/56521/6_684_clipped_527:0 (151 letters) Query: 1 CTTCAAAGAGGGAGAATTACGTCGATATTACCGAAGGCTGGGAGAAGGGTGAAAATACAA 60 … | |
Obviously, here is the initial code for this blackjack game. and in order for me to feel confident in this game I need to have an error check to make sure that there are at least 7 cards per player. And I have to do this in the second part … | |
My tutor suggested me to use deep copy for copying tuples for pawn-chess game... can anyone help me out with how actually deep copy works ?? coz if i know it i can work it out in a more smoother way... n yea... m new to python !! | |
Crypting with xor allows one to write one function that can encrypt and decrypt a file. In this example a text file is used, but it could be an image file as well. Once you have created the encrypted file you simply send it through the same function again to … | |
[CODE]file=open(words.txt) print(file)[/CODE] Please Ive been trying to use the open() function to open a txt file in python, but it keeps telling me that there is no such file or directory, where should I put the file for me to be able to import it. HINT: I use pyscripter, but … | |
Hello, I was curious to know if there was some way to change a .py file to a .pbp file. I know that I can easily make an .exe file with py2exe, is there something like that for pbp? | |
Anyone work with UltimateListCtrl's before? I'm looking for a way to dynamically change the column headers background color. | |
hi all... i want to upload a file using ftp path1 = "D:\Python\test" host = sys.argv[1] def main(): try: f = ftplib.FTP(host) except (socket.error ,socket.gaierror),e: logging.info("Error: cannot reach '%s',%s" % (host,e)) return logging.info("***connected to host '%s'***" % host) try: f.login(user="root",passwd="aims") except ftplib.error_perm: logging.info("Error :cannot login ") f.quit() return logging.info("***logged in … | |
I can't work out why when i try to print the list(listProb....s) it prints the empty list, i'm not setting them to the empty list after this code or anything, and when i print the normDistProb's on their own it prints fine): [CODE]for i in range(0,12): listProbFog.append(normDistProb(dayValues[i], fogAve[i], fogVar[i])) listProbSnow.append(normDistPr...ob(dayValues[i], … |
The End.