15,175 Topics
| |
Write the definition of a function power_to , which receives two parameters. The first is a double and the second is an int . The function returns a double . If the second parameter is negative, the function returns zero. Otherwise it returns the value of the first parameter raised … | |
We need to ensure that the connection is secure. The python version we use is 2.6. Trying to call prot_p() explicitly errors out. How do we ensure that the connection is secure. >>> from M2Crypto import ftpslib >>> ftps = ftpslib.FTP_TLS(host) >>> ftps.login(username, password) '230 User logged in.' >>> ftps.prot_p() … | |
Hi I need help using the variable mytik as a counter in the GUI "app" If you run this code mytik stays at 1,2,3,4 or 5 as entered but when I need it for a counter in the next GUI window it no longer has the value of say "1,2,3,4,or … | |
def isPrime(num,div=2): if(num==div): return True elif(num % div == 0): return False else: return isPrime(num,div+1) | |
I am trying to extend a script that opens a web browser and opens URL. I want to use that script and make it to search google for particular query. That's all. Here's the code that I got. I would appreciate, if you know how to extend it for the … | |
Hi there, I have a set of values and I know that some of them are good and some are not... but I cannot find the ratio. I know it souns strange but let me explain. Here is the list of values 37 - 16 - good 21 - 12 … | |
I'm trying to write a small program to loop through a list of words and find the numeric order of the letters in the string, e.g. HELLO will return 21345 (I don't want to double up numbers) and PROSPER will be 3527416. I'm having trouble thinking of a way I … | |
Hi can anyone help me i am using python 3 and i am new here. I want to know how i can make these random numbers, example: 4 11 17 21 44 - 20 show up, like the example. The problem is the last #20 shows up below the others. … | |
Am trying to get a function call but i cant get it to print. Please help here. This is the code: def foo(): name = input ('>>').lower().split() for item in name: if name == foo: print ('foo here!') else: bar() def bar(): name = input ('>>').lower().split() for item in name: … | |
Not usually one to have to do this, but I cannot find the problem with my code. Yes, this is a project Euler problem. Any tips or suggestions help. My code works by getting the location of each number, excluding the first numbers as it has to be predefined, and … | |
I have this: dic = {'ál':1, 'él':2} string = "ÉL" number=dic[string.lower()] and it's giving me a KeyError. I realize then that 'ÉL'.lower() is giving me 'Él', i.e. it is not affecting the É at all because some weird Python 2.x encoding issue. Can somebody help me please? I can't tell … | |
a1 = 1 a2 = 2 a3 = 3 ....... a10000 = 10000 So, I want to create a function that will autoassign names to numbers. In the the code above, for x in range (desired range): a(quantity of x) = x how do i get my code to call … | |
I am having a problem with a loan calculator that I am building. It keeps telling me that the interest_rate variable it referenced before assignment. I'm fairly new to python and was wondering if anyone had any ideas as to what is wrong with my code. Any help would be … | |
hi all... how to find the localhost ip address in python [B]import socket socket.gethostbyname(socket.gethostname())[/B] gives me 127.0.0.1 instead of my ip address any help........... | |
I'm wondering if anyone has any experiencing getting a python application to authenticate with google docs. I'm not sure how to begin. Goal: To update a google docs spreadsheet based of a CSV file on my local machine. Currently my google account is set for two factor authentication. Perhaps this … | |
getting errror related to pkg_resources while running PIP PIP install cython Traceback (most recent call last): File "/usr/local/bin/PIP", line 6, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.require(__requires__) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require needed = self.resolve(parse_requirements(requirements)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) … | |
How would I use [web.py](http://www.webpy.org) to execute ASP/PHP server files? Or can web.py not do that and can someone provide me a python script that can execute ASP/PHP server files? Should I try posting this in the PHP forum, Web Design, html, and css fourm, or the Web development forum … | |
Hi am kinda new in python programing. I have this game that involves a user inputs a value , say color it iterates over imported modules( in this case color) and prints data about it. The problem is that i cant get to code the best way to iterate over … | |
I'm attempint to write a python application that will open a .csv file and look at comun one for certain string. If the string match print the row to a new .csv file. import csv input_file = csv.DictReader(open("stats.csv")) for row in input_file: print row | |
I have a package of python modules that I need to import to another module. Wi use of user input of a string or interger, the module is to iterate over the list of the modules to find the one with an answer as follows. from hometests.clauses import * # … | |
Hi I have simple python script that open a TCP socket,connect to the SMTP servert and issue a VRFY command. When I run the script I got error,I wonder How can I fix error? #!/usr/bin/python import socket import sys if len(sys.argv) != 2: print "Usage: vrfy.py <username>" sys.exit(0) # Create … | |
“Guess the number” game One of the simplest two-player games is “Guess the number”. The first player thinks of a secret number in some known range while the second player attempts to guess the number. After each guess, the first player answers either “Higher”, “Lower” or “Correct!” depending on whether … | |
greens = dict(green="#0080000", olive="#808000", lime="#00FF00") >>> print("{green} {olive} {lime}".format(**greens)) -> #0080000 #808000 #00FF00 In the program above what are green, olive, and lime in the dict function? I've seen and read about supplying a function with keyword arguments but only when the function was written with default argument. Even then … | |
I am currently trying to write a simple multi-threading program using Python. However I have run on to a bug I think I am missing. I am trying to simply write a program that uses a brute force approach the problem below: ![376dc6dd28649dd49ee987fbaf913b75](/attachments/small/0/376dc6dd28649dd49ee987fbaf913b75.gif ) As can be seen from the … | |
I want to extract this data from a website `You need to add the numbers present in this string. Your string is: 3754537dd2f082ad578e0ff1806d86a6` This is what I was doing url = opener.open('http://www.website.com') data = url.read() extract = re.search('your string is: <strong>(.*)', data) ans = extract.group(1) ans = string.split(ans, '</strong>')[0] print … | |
I want a code in python, to convert binary to decimal however i want the user the choose which way to convert the number(i.e, binary to decimal or decimal to binary) thank you | |
lol don't take any offence to the title XD just being funny :P anyways... I'm having a problem with my function... it's supposed to allow you to read/write float values in any specified byte length. but there's a problem with the output value >_> first off though I must state … | |
Looking to test my library and implementing it so that insert function can assign the index of the rear in th e ring after the items are inserted in ring class CircularQueue: def __init__(self, size): """ ------------------------------------------------------- Initializes an empty queue. Data is stored in a list. ------------------------------------------------------- Postconditions: Initializes … | |
Hi i am new to python and i am trying to create a GUI application which will hold different games aimed for autistic children, from where these games can be played. I have imported the scripts to the Gui application area as follows from tkinter import * from tkinter.messagebox import … | |
Im new to programming python3 and i'm trying to write a password program. i want to compare a word from a .txt file with a input. no matter if i type the password in write or wrong it always comes up 'access denied!' inFile = open('passwordtest.txt', 'r') password = inFile.read() … |
The End.