text
stringlengths
226
34.5k
Python IndentationError - How to refactor? Question: I am doing a [Project Euler](https://projecteuler.net) question for programming practice in order to self-teach myself. I know perfectly well _how_ to do the question mathematically, _as well as_ how to do it programmatically. However, I have to have come up with so...
Open and preprocessing file in Python NLTK Question: Im new to Python NLTK and really need your advise. I want to open my own txt file and do some preprocessing like replacing words with its regex. I've tried to do it as in NLTK 2.0 Cookbook import re replacement_patterns = [ (r'won\'t', ...
Eclipse Error: no jogl in java.library.path Question: So I'm quite new to eclipse (first week of actually trying to use it to develop stuff.) and I tried to import an example project from <http://unfoldingmaps.org/> and upon trying to compile their test project I'm greeted with the error: Eclipse Error: Exception in t...
wxPython minimal size of Frame with a Panel Question: wxpython 2.8.11.0, python 2.7 If i put some `Sizer` with some controls directly into a `Frame` like import wx app=wx.App() frm = wx.Frame(None, title='title') sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(wx.SpinCtrl(frm...
seek to regex in a large file using python Question: I am trying to seek to a token ':path,' in a file, then read all the following (arbitrary digit count) numbers as a number (so for ':path,123' I seek to the , in file then read the integer 123). Then read the chars between the current seek position and pos+123 (store...
Python Fabric load config from separate file Question: I am use python fabric with all configuration in one .fab file. How can I put sensitive data as password to separate file and then import/load to fab main file? Answer: Define a simple function within your fabfile.py to read your passwords out of a separate fil...
django/python variables inside strings? Question: I'm new to python and would like some assistance. I have a variable q = request.GET['q'] How do I insert the variable `q` inside this: url = "http://search.com/search?term="+q+"&location=sf" Now I'm not sure what the convention...
pyspotify Segmentation Fault (libspotify) Question: I am trying to work with pyspotify with but no luck. Setup: * Ubuntu - 12.04 TLS - fresh(ish) install * virtualenv - 1.8.2 * libspotify - 12.1.51 * pyspotiy - dev (1.8) I have the pyspotify example `jukebox.py` but when I run it it always gives Segmentation...
Virtualenv shell errors Question: I've just installed virtualenv (with Python 2.7.2) on my Mac, and I followed the guide here: <http://virtualenvwrapper.readthedocs.org/en/latest/install.html> But I now get the following errors when I start up my shell every time: stevedore.extension Could not load 'use...
I want to fetch json data from a given url And that json data i have to convert into xml form Question: I want to fetch JSON data from a given url http://www.deanclatworthy.com/imdb/?=The+Green+Mile and convert the JSON data into XML. I have used [`urllib`](http://docs.python.org/library/urllib.htm...
Trying to append items to a list in python but its acting odd Question: I have events, people can belong an event. So I have an event class that looks like: class Event(): name = "" people = [] I also have a global variable to hold all the events events = [] N...
Python CGI in IIS: issue with urandom function Question: I’m having a very strange issue with running a python CGI script in IIS. The script is running in a custom application pool which uses a user account from the domain for identity. Impersonation is disabled for the site and Kerberos is used for authentication. ...
Stepping into a function in IPython Question: Is there a way to step into the first line of a function in ipython. I imagine something that would look like: %step foo(1, 2) which runs `ipdb` and sets a breakpoint at the first line of `foo`. If I want to do this now I have to go to the function's s...
indexing an array Question: I find myself frequently making indexed lists from flat ones in Python. This is such a common task that I was wondering if there's a standard utility that I should be using for it. The context is this: given an array, I need to create a dict of smaller arrays using some key for grouping. e...
start python program in the background that can prompt the user for password Question: Basically I wanted to start a daemon in the background that will still prompt the user in the console for a password. I created this with pexpect, but when this program ends it kills the daemon since it is a child process. So obvious...
Building an HTML Diff/Patch Algorithm Question: A description of what I'm going to accomplish: * Input 2 (N is not essential) HTML documents. * Standardize the HTML format * Diff the two documents -- external styles are not important but anything inline to the document will be included. * Determine delta at ...
Is it possible to extract preprocessor information from clang's parse tree? Question: Consider the following simple header, demo.h: #define PERSIST struct Serialised { int someTransientValue ; PERSIST int aNumberToPersist ; }; I use the following code and Clang's python ...
Problems with PYTHONPATH Question: From the command line (Mac OS), when I execute 'echo $PYTHONPATH' I get: > /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 If I then enter the Python interpreter and do the following: >>> import os >>> os.environ['PYTHO...
numpy.shape gives inconsistent responses - why? Question: I'm a newbie to python. What I would like to know is, Why does the program import numpy as np c = np.array([1,2]) print(c.shape) d = np.array([[1],[2]]).transpose() print(d.shape) give (2,) (1,2) ...
Add two 3D numpy arrays with a 2D mask Question: I would like to add two 3D numpy arrays (RGB image arrays) with a 2D mask generated by some algorithms on a greyscale image. What is the best way to do this? As an example of what I am trying to do: from PIL import Image, ImageChops, ImageOps import n...
Running a timer for few minutes in python Question: I am trying to run a certain function "foo" every second. I have to do this for a few minutes (say 5). The function foo() makes 100 HTTP Requests (which contains a JSON object) to the server and prints the JSON response. In short, I have to make 100 HTTP requests pe...
How to Change Content-Type Python Question: I want to upload a file to a remote device. If i look up the connection with wireshark i get this POST /saveRestore.htm.cgi HTTP/1.1 Host: 10.128.115.214 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1 Accept...
Popen stdout reading pipe, deadlock using sleep Question: Well, I have two scripts. The a.py which prints the output of the b.py script as follows: #a.py from subprocess import Popen, PIPE, STDOUT p = Popen(['/Users/damian/Desktop/b.py'], shell=False, stdout=PIPE, stderr=STDOUT) whi...
python enums with attributes Question: Consider: class Item: def __init__(self, a, b): self.a = a self.b = b class Items: GREEN = Item('a', 'b') BLUE = Item('c', 'd') Is there a way to adapt the ideas for simple enums to this case? (see [this qu...
Writing a python Dictionary to a CSV file with keys as column headers Question: I'm trying to write the elements in my dictionary into a text file where each key would be a column. Currently have I something that looks like import csv import numpy as np data1 = np.arange(10) da...
Clean up code when Ctrl+C is caught in python Question: By registering the signal handler, I can put my clean up code in signal_handler signal.signal(signal.SIGINT, signal_handler) But the problem is when user presses ctrl+c multiple times, the signal handler run multiple times and the clean up goe...
Selectively dump object attributes with PyYAML Question: I can use YAML to dump a hierarchy of python objects, so: import yaml class C(): def __init__(self, x, y): self.x = x self.y = y class D(): def __init__(self, c, d): self.c = c ...
How to get the content from a certain <table> using python? Question: I have some `<tr>`s, like this: <tr align=center><td>10876151</td><td><a href=userstatus?user_id=yangfanhit>yangfanhit</a></td><td><a href=problem?id=3155>3155</a></td><td><font color=blue>Accepted</font></td><td>344K</td><td>219MS</td...
Communicating with a hardware offering a Python interface using iOS Question: I have to access a hardware component that exposes the following Python interface: $ python >>> from ***.***.***.*** import * >>> client = Client('http://*****') >>> client.getFirmwareVersion() How I...
How can I download only metadata from a Google Sites API content feed? Question: I want to download a list of URLs for pages in my Google Sites site. I'm using the Python API to do this. It seems to be slower than I would expect, and so I think it's actually downloading the whole content for each entry rather than just...
time.sleep hangs multithread function in python Question: I am having trouble with a sleep statement hanging my multithreading function. I want my function to go about it's buisness while the rest of the program runs. Here is a toy that recreates my problem: import multiprocessing, sys, time def...
Python PIL reading PNG from STDIN Question: I am having a problem reading png images from STDIN using PIL. When the image is written by PIL it is all [scrambled](http://cl.ly/image/3z1k2B1J3F0t), but if I write the file using simple file open, write and close the file is saved [perfectly](http://cl.ly/image/3i1w2C0I1o3...
App Engine, PIL and overlaying text Question: I'm trying to overlay some text over an image on GAE. Now they expose the PIL library it should not be problem. Here's what I have. It works, but I can't help think I should be writing directly to the background image rather than creating a separate overlay image and then ...
Cython and fortran - how to compile together without f2py Question: **FINAL UPDATE** This question is about how to write a `setup.py` that will compile a cython module which accesses FORTRAN code directly, like C would. It was a rather long and arduous journey to the solution, but the full mess is included below for c...
How to do multiple string replacements in a cleaner manner? - Python Question: What is a fast way of doing multiple string.replace? I'm trying to add spaces to shorten english words like he'll -> he 'll he's -> he 's we're -> we 're we've -> we 've also i'm adding spaces in between befo...
GAE can't import Web.py module in virtualenv Question: I'm trying to set up a Web.py (0.37) project in a virtualenv to run on Google App Engine (1.7.2) but I'm getting a `ImportError: No module named web` from the appserver. I've installed web.py using `python setup.py install` from inside my virtualenv and can confir...
How to reuse user's raw input in other function Question: I m making a 2D board game for python for hw. I asked user to input a integer for the board size. for example, 7. I have modified a bit (only show the important ones) before posting. the function is like follows def asksize(): ...
Automating virtualenv and Django development server startup with fabric? Question: > **Possible Duplicate:** > [Activate a virtualenv via fabric as deploy > user](http://stackoverflow.com/questions/1180411/activate-a-virtualenv-via- > fabric-as-deploy-user) I've been advised to try and use fabric for deploying Djan...
QtSingleApplication for PySide or PyQt Question: Is there a Python version of the C++ class [`QtSingleApplication`](http://doc.qt.digia.com/solutions/4/qtsingleapplication/qtsingleapplication.html) from [Qt Solutions](http://qt.digia.com/Product/Qt-Add-Ons/Qt-Solutions- Archive/)? [`QtSingleApplication`](http://doc.qt...
Writing and importing custom modules/classes Question: I've got a class that I'm trying to write called dbObject and I'm trying to import it from a script in a different folder. My structure is as follows: /var/www/html/py/testobj.py /var/www/html/py/obj/dbObject.py /var/www/html/py/obj...
Is it possible to use the Yahoo Query Language to download historical financial data? Question: I've used the Yahoo Finance site to download historical data, using queries like this: http://ichart.finance.yahoo.com/table.csv?s=AAPL&c=1962 and the accompanying Python code: import urll...
How to create REST API application using python Bottle framework and how to deploy it on apache server? Question: I want to create one sample application for api's using python Bottle framework, I want to deploy that application on apache server as well, I use following sample code, from bottle import ro...
Python sum() returns negative value because the sum is too large for 32bit integer Question: x = [1, 2, 3, ... ] y = sum(x) The sum of `x` is 2165496761, which is larger than the limit of 32bit integer So `sum(x)` returns -2129470535. How can I get the correct value by converting it to long integer? He...
easy_install conflict for python2.4 and python2.7 Question: I have installed python under /opt/python2.7.1/ on CentOS machine which has already python2.4 and configure it to run python2.7 default. However, when I write 'easy_install' it raises error like Traceback (most recent call last): File "...
Get absolute path of file why traversing through another directory Question: I have a small snipped in python which intends to traverse through all the directory , subdirectory and manitain a list of absolute path of all the files . code: import os , pickle root="/home/me/programs/" l = [] #Will...
DNS server client communication protocol Question: I need to write a paper on how DNS works and build a small but functional DNS server in python. I have a simple UDP socket server that opens a thread when a packet is received like this: while 1: try: stream, addr = serversocket.recvfrom(b...
Append xml to xml using python.I have two xml files which i need to merge .so is there anyway i can merge both files Question: can anybody tell me how to append xml files using python this is my file1.xml <?xml version="1.0"?> <addressbook> <person> <name>Eric Idle</name> ...
PrintWriter flush not working? Question: I'm trying to get the following code working so that I can use it somewhere else. Effectively, it (is supposed to) start another process, run python in it, and feed python some commands. However, in practice, unless I close the stream to that process, the the python commands ar...
Python Requests and persistent sessions Question: I am using the [requests](http://docs.python-requests.org/en/latest/) module (version 0.10.0 with Python 2.5). I have figured out how to submit data to a login form on a website and retrieve the session key, but I can't see an obvious way to use this session key in subs...
Post-EasyTether, PDANet Tethering Samsung Galaxy 4g to Mac OS X 10.7.4 to Implement Python Question: I'm using Mac OS X Version 10.7.4 and Python 3.2.3. I've read through many of the equally frustrated posts on Stack Overflow, this one was especially useful in helping me delete EasyTether after it didn't work, and turn...
python epoll and nonblocking Question: simple client-server socket studying code,the server-end is: import socket,select,time s = socket.socket() host = socket.gethostname() port = 1234 s.bind((host,port)) s.listen(50) s.setblocking(0) # (1) fdmap =...
how to launch a command window from Python Question: I'd like to use Python 2.6 on Windows to launch several **separate** command windows, each running their own Python script. The purpose is: these are clients, and I'm trying to load up the server with requests from multiple quasi-independent clients. I don't need to...
python: combine values in one column on the basis of ids in another column Question: I need to combine values in second column of a tab delimited file based on the ids in first column. The example is given below. What is the fastest way to do this. I can do it using for loop, going through each line, but I am sure ther...
Python TypeError when using class (wx.Python) Question: This program is that wx.textctrl is written "clicked" when button is clicked. This code runs without error. import wx class Mainwindow(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, paren...
Merging similar dictionaries in a list together Question: New to python here. I've been pulling my hair for hours and still can't figure this out. I have a list of dictionaries: [ {'FX0XST001.MID5': '195', 'Name': 'Firmicutes', 'Taxonomy ID': '1239', 'Type': 'phylum'} {'FX0XST001.MID13': '4929', '...
Modulo operator in Python Question: What does modulo in the following piece of code do? from math import * 3.14 % 2 * pi How do we calculate modulo on a floating point number? Answer: Mathematically, the modulo operator can be represented as: a % b = c a - n*b = c Whe...
Heroku Django: Redirect all requests for www. to root domain Question: I need to redirect all requests coming from `www.mysite.com` to `mysite.com` I have found the [solution in rails](http://blog.dynamic50.com/2011/02/22/redirect-all-requests-for-www-to- root-domain-with-heroku/), but how can I do that in django/pyth...
Use Python to Optimally find Top 10 recently created files Question: I am trying to find a optimal way of extracting most recently, say 10, created files from a directory tree using Python. I've found a number[1, 2] of interesting solutions, however, they only involved a single file. ...
runserver must be manually restarted after error in models.py Question: I'm following the book The Definitive Guide to Django and one thing I've started noticing is that whenever I make a single error in my models file, the server just hangs and is not automatically restarted when the error is fixed. Here's an example...
Unable to execute Django runserver and no suggested solution seems to work Question: I've run Django servers on localhost before and have never run into this problem. I'm desperately trying to figure out what I've done wrong. I'm using Django 1.4 with Python 2.7 on Ubuntu 12.04. As far as I can tell I've configured e...
Weird select error in python Question: Ok, so I have Python 2.5 and Windows XP. I was using select.select with a socket object. I tried it again and again, but whenever I run it, the thread it is in gives me an error like select.error(9, "Bad file descriptor"). The code is something like this: import soc...
How to remove accents from strings using Python (encoding parameter)? Question: I'm trying to remove accents from data in a csv file. So I use the remove_accents function (See below) but for that I need to encode my csv files in utf-8. But I've got the error `'encoding' is an invalid keyword argument for this function`...
Issues with pyinstaller Question: I have created a working GUI program (using tkinter), but when I try to compile it using pyinstaller (py2exe only works for python 2.6 and I used 2.7 for the program), it doesn't work. I have 2 files: program.py, and data.xml. The program uses the xml document to retrieve information a...
python "import media" didn't work but there was "media.py" Question: I read a book to learn python programming, it showed the code : import media So I downloaded `gwpy-code.zip` from the link <http://pragprog.com/titles/gwpy/source_code> and installed `PyGraphics-2.0.win32.exe` . In the path `C:\Py...
urllib "module object is not callable" Question: This is my third python project, and I've received an error message: `'module object' is not callable`. I know that this means I'm referencing a variable or function incorrectly. But trial and error hasn't been able to help me solve this. import urllib ...
Unable to use raw_input() during event handeling in Matplotlib while running pylab -- RuntimeError: can't re-enter readline Question: I'm trying to write a script that allows the user to manipulate a graph via event handling in matplotlib, but I need to have them enter some additional information through the terminal ...
How to download a text file or some objects from webpage using Python? Question: I am writing a function that downloads and stores the today's list of pre- release domains .txt file from <http://www.namejet.com/pages/downloads.aspx>. I am trying to achieve it using json. import json import requests ...
How to download text file from website using Python? Question: I need to write a function that downloads and stores the today's list of pre- release domains .txt file from `http://www.namejet.com/pages/downloads.aspx.` So as today is 8th of October you want to get the file "Monday, October 08, 2012". Tried with request...
MacOSX python error on import Question: Ive recently installed SimpleCV using the osX-Lion setup instructions in page <https://github.com/ingenuitas/simplecv> Then I type python in Terminal and when I try the following I get an error. import SimpleCV Fatal Python error: (pygame parachute) Segmentati...
The right way to architect a cluster in EC2 Question: I'm working on open-source tool which will have to run on a cluster in EC2, organized in "one master - several slaves" manner. I need some advice on how to organize things correctly and in the most simple, yet reliable way. What I basically need is a code which wil...
How to parse YouTube XML using Python? Question: I am trying to parse the xml from YouTube that is embedded in the code below. I am trying to display all of the titles. However, I am running into trouble when I try to print the 'title' only enter lines appear. Any advice? #import library to do http reque...
Execute code on App Engine application initialization Question: When running a Python Web Application on App Engine, we need to set up some mechanism to execute some code before (or during) the application's initialization. This means that, in the optimal solution, the code that we need to run is executed as early as p...
python: how to store data in mongo via http put Question: I am trying to create a REST API application using python bottle framework I'd like to be able to insert data in mongodb via HTTP PUT request. So far I am able to get response from the mongodb using HTTP GET. Please help me INSERT data in mongodb via HTTP PUT...
How to run a DOS batch file in background using Python? Question: How to run a DOS batch file in background using Python? I have a test.bat file in say C:\ Now, I want to run this bat file using python in the background and then I want to return to the python command line. I run the batch file using `subprocess.cal...
handling exceptions in settrace 'return' calls Question: In Python 2.x, the frame object passed into a [`settrace`](http://docs.python.org/py3k/library/sys.html#sys.settrace) handler had an `f_exc_type` attribute. In Python 3.x, this `f_exc_type` has been removed. If a function is propagating an exception, the trace ...
re-implement __eq__ to compare sets with symmetric_difference in python Question: I have a set of filenames coming from two different directories. currList=set(['pathA/file1', 'pathA/file2', 'pathB/file3', etc.]) My code is processing the files, and need to change currList by comparing it to its co...
Error while installing MySQLdb for Python on Mac OSX 10.6.8 with mysql inside XAMPP Question: I am trying to import MySQldb in python and call the python script from a php script in XAMPP. Here is what I did: Environment: 1\. Mac OSX 10.6.8 2\. Python version 2.6 (default)[64bit] Done so far: 1\. Installed XAMPP 2\. ...
unable to get values from a login page in web.py Question: I am using python web.py framework to create a small web application which has just 1. Login screen (Authentication) 2. Screen with list of records(After succesfull login) Presently i am trying to create a login screen authentication I have created an `...
Pydev using wrong IPython version? Question: I have Pydev 2.7, Python 3.2 and IPython 0.13 installed. However, when I run the interactive console in Eclipse it says PyDev console: using IPython 0.11 I cannot imagine where IPython 0.11 is supposed to come from. How can I check? After running the co...
Unable to switch between two boto.cfg files Question: I have two _boto.cfg_ files, one for QA and the other for Production. I can choose dynamically which _boto.cfg_ to choose. When I choose QA and call `get_all_buckets()` I get all the buckets of QA. But when I change to Production, it still returns QA buckets. My scr...
python, unittest, test a script with command line args Question: I've written a python script that takes command line arguments and plays one round of Tic Tac Toe. running it looks like this... > run ttt o#xo##x## x 0 1 If the move is legal it then prints the new board layout and whether anyone won the game I have...
What is the difference between Abstract classes and Mixins in Python django Question: Can anyone please tell what is the difference between Abstract class and Mixin in Django. I mean if we are to inherit some methods from base class why there is separate terminology like mixins if that is just a class. What is diff be...
concept of session and cookie in web development python Question: I am very new to web development, i am working on `web.py` framework to develop a small web application. suppose the login screen is `localhost:9090/login`, after the succesfull login it is redirecting to next page `localhost:9090/details` and after clic...
The __str__ method returning a unicode string works in one environment but fails in another Question: I thought, I understood unicode and python. But this issue confuses me a lot. Look at this small test program: # -*- coding: utf-8 -*- class TestC(object): def __str__(self): ...
permission denied when creating an .html file in python Question: so this is my first python experience. I have a list of images in folder that I'm trying to convert to html pages. For that I have the following code: import inspect, os, errno, markup path = os.path.dirname(os.path.abspath(inspect....
How to send Python variable to bash variable? Question: I am trying to use Python to select a variable from a list, then speak it outloud using the bash command. Right now I have something like this foo = ["a","b","c","d"] from random import choice x = choice(foo) foo.remove(x) from os im...
How to get all YouTube comments with Python's gdata module? Question: Looking to grab all the comments from a given video, rather than go one page at a time. from gdata import youtube as yt from gdata.youtube import service as yts client = yts.YouTubeService() client.ClientLogin(username...
Subversion Get Text Status Data in Python Commit Hooks Question: I'm looking for a way to extend Python Commit Hooks such that I can ONLY find out all the files that were modified excluding all the revision properties changed. Is there a SVN.Core or SVN.fs or another SVN import lib function that I could use? I'm curr...
python listing and counting values Question: In the sample data given below (stored in a file), I need to find distinct 'ids' in each 'item' category in the fastest way possible. I can do this by going through each line and then finding all item sets and then count, but I am looking for a faster method such as 'Counter...
Python web scraping pauses Question: I have the following code: #!/usr/bin/env python from mechanize import Browser from BeautifulSoup import BeautifulSoup mech = Browser() mech.set_handle_robots(False) url = "http://storage.googleapis.com/patents/retro/2011/ad20111231-02.zip" ...
cannot run python script file using windows prompt Question: I am trying to run a python script from the windows command prompt, but I receive the following error message: _"python: can't open file 'pacman.py': [Errno 2] No such file or directory"_ when I try the command: c:\Program Files (x86)\Python2...
How python handles object instantiation in a ' for' loop Question: I've got a highly complex class : class C: pass And I've got this test code : for j in range(10): c = C() print c Which gives : <__main__.C instance at 0x7f7336a6cb00> ...
Loading Django apps for development Question: So, I've got this set-up in which I installed a django project (the directory containing the settings.py and manage.py) in the site-packages directory of my python installation. I've done this to use apps from other packages, which works nicely. I noticed however, that when...
Django mod_python logging issues Question: I'm trying to debug my view file in Django. I'm using Django 1.3 with mod_python on server. How can I see some out from my view file. I already try to use standart logging configuration LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'fo...
Why does this extremely simple wxPython AUI application crash on launch? Question: I'm making a Regular Expression testing tool for work. I would like it to be a simple AUI application, but after transferring what seems to me to be the **core** of an AUI application from the demo to my code, it crashes on startup. I ca...
Build an Eclipse workspace with TeamCity Question: I am in the process of converting our existing custom continuous build system to use TeamCity. This appears to work well for most of our build scenarios but one. We have a hardware project that is set up to build using Eclipse configured with a specific set of tool ch...
Python telnetlib read's only print "bs" Question: I'm trying to do some telnet automation with Python (only _pure_ Python). When I try to print some of my read's in the function `read_until`, all I see are a series of `bs`'s -- that's `bs`, as in the `backspace` character, not something else. :-) Does anyone know if t...
Python read text files in numpy array when empty or single line Question: I am reading from text files with the code below: import numpy as np my_data = np.genfromtxt(resultsDirectory+'/Points.txt', delimiter=' ') PointX = my_data[:,5] PointY = my_data[:,11] My input files are typically...
Integer division: is a//b == int(a/b) true for all integers a,b? Question: I know that integer division will always return the same answer as truncation of a floating point result if the numbers are both positive. Is it true if one or both of them are negative? I was just curious to know if there was an integer divisi...
Finding the square root using Newton's method (errors!) Question: I'm working to finish a math problem that approximates the square root of a number using Newton's guess and check method in Python. The user is supposed to enter a number, an initial guess for the number, and how many times they want to check their answe...