15,179 Topics
| |
I am trying to write a program that graphically presents three doors and ask the user to choose the “special” door (randomly selected by the program). If the user correctly chooses the special door, it’s a win. If either of the other two non-special doors is selected, it’s a loss. … | |
I was testing this in prompt mode: import re def checkurl(url): check = re.match(r'^(:?https?://)?[^\/#?&]+\.[^\/#?&]+.*$',url) if check == None: print “NNOOOOOO!!!!” else: print “YESSSS!!!!!” checkurl("javascript:void(0);") checkurl("/account/general?ru=https%3a%2f%2fwww.bing.com%3a443%2fsearch%3fq%3dukraine%2bcrisis&FORM=SEFD") checkurl("/?FORM=Z9FD1") checkurl("http://choice.microsoft.com") I have no idea why this won't work. Ignore the regex its only supposed to weed out relative paths and fragments of strings. … | |
| Hello folks, I am currently in 2nd year of Masters Degree and I am expected to develop a project this year from the given topics. I find Command Based text editor like vi fascinating as others were boring. So, here is the project definition. **In this project you are expected … |
* * * * * * * * * * * * * * * * * * * * * * | |
Hey, guys! Newbie here. =) I try to reverse an image but an error came and i don't know why :/ This is the error: Traceback (most recent call last): File "C:/Users/Florian/Documents/ISN/S10/défi11.py", line 10, in <module> im.putpixel((x,600-y),(p[0],p[1],p[2])) File "C:\Python27\lib\site-packages\PIL\Image.py", line 1267, in putpixel return self.im.putpixel(xy, value) IndexError: image index out … | |
I have to complete a project which have an text file and finds path between 2 actors(kevin bacin game) that you input by going through the movies in the text file. For example if the text file is: Apollo13 Kevin Bacon Tom Hanks Gary sinise HollowMan Elisabeth Shue Kevin Bacon … | |
Hi guys, I'm trying to draw multiple diagonal lines in python, I know I have to use a loop but how do I get the lines to draw in different places? i.e \\\\\ \\\\\ | |
Hi Guys, I need python script to assign 100 IP addresses to VMs present in the same ESX host. can anyone help me with this. | |
I have to complete a lab which basically takes a text file and finds path between 2 actors that you input by going through the movies in the text file. (For the labs purposes we are only doing 3 degrees of separation) For example if the text file is: [QUOTE]Apollo13 … | |
I am creating a contact program with python and wxpython. While creating the browsing function for my program I ran into a problem. I've been searching for hours trying to find a way to fix it. Unfortunately I haven't had any luck on fixing the error/problem. Here is the code … | |
Hi, I'm currently trying to create a Pattern on python which I'm really struggling to figure out. I'm trying to recreate the patch in the picture I've uploaded however I can't figure out where I'm going wrong. I'm really confused and I'd really appreciate it if someone could help me. … | |
This is for a senior-year project with an [ANFIS](http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=256541) (adaptive neuro-fuzzy inference system) module to be used as a predictor for financial instruments. The bulk of the system will be written in Python—chosen for its ease of use and the presence of libraries for genetic programming, another component of the … | |
Hi, I've just started using Python/Pygame as a hobby. I've gotten the code to draw my Plane.png and move it using the wsad keys, and I mapped the q and e keys to rotate it which it does, but each time it rotates, it 'falls' down the screen to the … | |
Hello, Please let me know how should we get the id of an entity and put it in the another entity. I have two entity User and Track. I tried the below code I couldn't make. Please help! class Review(webapp2.RequestHandler): template = JE.get_template('templates/Review.html') self.response.out.write(template.render()) def post(self): n = self.request.get('user_name') t … | |
Hello! I'm trying to transform working Python code to Matlab code. It's Simpson's rule. But MatLab code is not working. What should I change for in this code? Python: from math import sin def f(x): return ((0.6369)*sin(sin(x))*sin(x)) def method_simpson_compost(f,a,b,n): h = (float(b)-a)/n i = 0 fks = 0.0 while i<=n: … | |
| I'm writing a bash script that redirects the output of a command to a file. The next thing the script should do is read the contents of the file, into the tenth line of a python script. It's tricky, because the line of text in the python script should read: … |
he following code gives the error UnboundLocalError: local variable 'currentpl' referenced before assignment: if user_choice == 0: currentpl = 1 elif user_choice == 1: currentpl = 2 while gameover(num_sq): if currentpl == 1: pick = getPlayerPick(num_sq) while not validPlay(pick, num_sq): pick = getPlayerPick(num_sq) makePlay(pick, player_col[currentpl]) if currentpl == 2: pick … | |
teacher assigned out of the book "python programming: an introduction to computer science. second edition. page 384 # 19 is as follows this below is verbatim from the book and the instructions for the assignment are "Python Assignment #10 Complete programming exercise #19 on page 384 from Chapter 11" create … | |
Hi so basically I need to create a timer for this simple maths test. I need it to give each question, lets say 30 seconds for test purposes, and then move onto the next question after the time is up and repeat the timer like that. Just cant figure it … | |
Hi everyone. I have question and i hope someone will be pleased to help me. I am trying to write a python script which can extract data from a file (Iter.dat) and then put data in a tableau like the out.dat file. Here is what i wrote: f = open('Iter.dat', … | |
Draw a group of shapes on the Tkinter GUI toolkit canvas and animate the group using the common tag names. | |
hi, have already written a GUI program on a different Pc, i copied the py file unto a new pc to continue with the building,i have installed all the necessary modules but it gives an error when i run it. Traceback (most recent call last): File "C:\Python34\aaaa.py", line 2, in … | |
Hi all I have got a problem with the list of strings. I have got the full list of strings, but I can't be able to print for each string which I can only print for the full string. When I use this: programList = list() # set the channels … | |
Need help with writing an algorithm: Department Store Sale! Prompt the user to enter the sticker price of each of the clothing items they’re purchasing (make sure all input prices are positive). The user should be allowed to purchase as many items as he or she would like. For each … | |
How do I change my inputs simple and compound with two decimals behind them? n = 5 rate = 0.05 for n in range(0, 3): principal = 10000 for n in range (0,6): principal <= 15000 simple = principal * (1 + rate * n) compound = principal * (1 … | |
I have wrote this code but it shows me only the timing not the values, can any bady tell me where is the problem? import time import random def procedure(): time.sleep(0.60) # measure process time t0 = time.clock() procedure() print time.clock() - t0, "seconds process time" #BUCKET SORT (up to … | |
Hi there! I've googled around, and can't seem to find an answer to this question: How do you check if UART# has already been enabled or not? And what I mean is, I need to be able to get into python and say "If uart1 is not enabled, enable it". … | |
Hi guys, I'm created the variables in the loops to generating the list of values and channels, I want to use the variable outside of the loop so I can get the list of values. I have a problem with get the list of values. When I try this: # … | |
Hello all, I was curious as to how run many jobs serially on a Cray XE6 machine. You usually qsub things with a ccmrun (for a serial job) or an aprun (instead of mpirun or mpiexec). I first wanted to use the Pool() function, but due to it not being … | |
I want to know hot to move 4 circle in python according to the dice roll. |
The End.