14,962 Topics

Member Avatar for
Member Avatar for vegaseat

This snippet shows you how to animate a dice roll with the Tkinter GUI, useful for many games that require a dice to give a random number from 1 to 6. An interesting use of Tkinter's grid(), grid_forget() and after() functions.

Member Avatar for Jake_6
0
4K
Member Avatar for punna.udaykumar

A series of different parts of sentences will be randomly put together to come up with new interesting sentences. using with Random, Integers, Print, Strings, Breaks, Functions, For, Range

Member Avatar for sneekula
0
481
Member Avatar for ao_py

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. …

Member Avatar for sneekula
0
888
Member Avatar for dancks

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. …

Member Avatar for Gribouillis
0
991
Member Avatar for Rahul47

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 …

0
60
Member Avatar for Johnny Blaz
Member Avatar for Florian_2

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 …

Member Avatar for vegaseat
0
781
Member Avatar for James_41

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 …

Member Avatar for juanpa_2510
0
3K
Member Avatar for fontana74

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 \\\\\ \\\\\

0
71
Member Avatar for prasanna.k

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.

Member Avatar for Gribouillis
0
772
Member Avatar for JJHT7439

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 …

Member Avatar for James_41
0
3K
Member Avatar for Noskes

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. …

0
75
Member Avatar for piovertwo

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 …

Member Avatar for Gribouillis
0
3K
Member Avatar for Alex_29

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 …

Member Avatar for juanpa_2510
0
4K
Member Avatar for Karthika_g

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 …

0
204
Member Avatar for Auroch

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: …

Member Avatar for Taywin
0
317
Member Avatar for Kadian

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 …

Member Avatar for snippsat
0
369
Member Avatar for photoguy77

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 …

Member Avatar for chriswelborn
0
366
Member Avatar for ncassambai

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 …

Member Avatar for woooee
0
141
Member Avatar for rogwar

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', …

Member Avatar for rogwar
0
260
Member Avatar for sneekula

Draw a group of shapes on the Tkinter GUI toolkit canvas and animate the group using the common tag names.

1
5K
Member Avatar for mcroni

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 …

Member Avatar for Gribouillis
0
336
Member Avatar for mark103

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 …

Member Avatar for Gribouillis
0
269
Member Avatar for david.nicely.393

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 …

Member Avatar for sneekula
0
132
Member Avatar for Chtaylor5201

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 …

Member Avatar for Gribouillis
0
116
Member Avatar for Diellza

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 …

Member Avatar for vegaseat
0
445
Member Avatar for cjohnweb

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". …

0
129
Member Avatar for mark103

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: # …

Member Avatar for Gribouillis
0
205
Member Avatar for fatalaccidents

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 …

0
145
Member Avatar for Muhammad_69
Member Avatar for sneekula
0
110

The End.