Posts
 
Reputation
Joined
Last Seen
Ranked #160
Strength to Increase Rep
+10
Strength to Decrease Rep
-2
94% Quality Score
Upvotes Received
107
Posts with Upvotes
94
Upvoting Members
49
Downvotes Received
5
Posts with Downvotes
5
Downvoting Members
4
28 Commented Posts
12 Endorsements
Ranked #136
Ranked #182
~330.31K People Reached
About Me

Working as a business analyst and system designer for financial companies in Hungary.

Interests
Software design, python
Favorite Tags

304 Posted Topics

Member Avatar for isendre

[code] n=6 print "\n".join([str(i+1)+'.'*n for i in range(n)]+["".join(chr(i) if i>=97 else '.' for i in range(96,97+n-1))]) [/code]

Member Avatar for cossy254
1
6K
Member Avatar for Luka_1

Yes. Someone can. But there is [no real automated converter](http://stackoverflow.com/questions/11792529/c-to-simpler-language-python-lua-etc-converter). This task sounds like (boring) work. And work is paid. To get someone to do this you have to motivate them with your own effort. If you write down the specification and the goal of the program, someone will help.

Member Avatar for Adina_2
0
72K
Member Avatar for vegaseat

I hope nobody thinks these algos are used in the real world. There are much better [algos](http://en.wikipedia.org/wiki/Primality_test) to determine if a number is prime. Since the beginning of the 20th century. These functions are good to understand how to program, and how to program in python. They are hardly usable …

Member Avatar for paddy3118
1
2K
Member Avatar for linny_faith

Your teacher is right. If you see lots of lines in the code, that differ from each other only in a few characters, then your code (or your programming language) is inefficient. Please remove globals. They render the code very hard to read. If you use "import \* " then …

Member Avatar for slate
0
642
Member Avatar for vegaseat

Simple RSA primtest. Does not work on universal pseudo primes. [code=python] def isprime(n,PROB): '''returns if the number is prime. Failure rate: 1/4**PROB ''' if n==2: return '1' if n==1 or n&1==0:return '0' s=0 d=n-1 while 1&d==0: s+=1 d>>=1 for i in range(PROB): a=random.randint(2,n-1) composit=True if pow(a,d,n)==1: composit=False if composit: for …

Member Avatar for amir_19
3
24K
Member Avatar for sarfrazashfaq

One solution would be putenv. On linux: abc.py: [code] import os uname="Some uname value" os.putenv("UNAME",uname) os.system("./test.sh") [/code] test.sh: [code] echo $UNAME [/code]

Member Avatar for jaakdentrekhaak
0
5K
Member Avatar for ayushi_3

Beside Gribouillis' explanation. > Although, sounds simple but still not able to understand the concept behind. Core concepts are the most hard things. > I would like to know how they picked up the module sys or how we gonna decide from where we need to import. The author picked …

Member Avatar for hastings.george.5
0
217
Member Avatar for Mark_64

I know, you did not ask, but the program should be more tight (compact). Something like this: import random def main() : tie_message="It's a draw. You both threw %s." win_message="You win! Your opponent threw %s." lose_message="You lost. Your opponent threw %s." values=("rock","paper","scissors") # must be in increasing beating order while …

Member Avatar for slate
0
299
Member Avatar for Jeah_1

Good luck! from random import randint def guess(): if int(input("Guess the number (1-10):"))==randint(1,10): print("Got it") else: print("Wrong!") guess() guess()

Member Avatar for slate
0
177
Member Avatar for Saif_6

You did not mention any reason that justifies creating a new tkinter mainloop. So take a look at these: http://tkinter.unpythonic.net/wiki/ModalWindow http://effbot.org/tkinterbook/tkinter-dialog-windows.htm You can make FirstScreen a modal toplevel window. If you want to keep the functionality to run the FirstScreen separately, then you can put it in a module (separate …

Member Avatar for slate
0
610
Member Avatar for Lucas_10

First try to make a version of it, that actually can be run by others. If I copy-paste your code into notepad, then save it, it does not run. I would recommend the following improvements after that: * Place imports at the top * Remove global variables, get rid of …

Member Avatar for Lucas_10
0
350
Member Avatar for wine_1

> I am not very clear about what does this mean, my original understanding is that x will keep data's first two dimensions, and take a slice from data on the third and fouth dimension. It keeps the first and fourth dimension and slices the two inbetween. `x=data[:,c:-c,d:-d]` The first …

Member Avatar for slate
0
282
Member Avatar for Mengchen

I/ if you import everything from turtle, like this: `from turtle import *` Then you cannot make statements like this: `point = turtle.Point(x,y)` You should do: `import turtle` II/ allTriMedian function is never called. So it is never executed. You should call it like: `allTriMedian()` III/ There is no Point …

Member Avatar for slate
0
988
Member Avatar for Gowda_1

Google is your friend. https://www.google.hu/search?q=python+smtplib+tutorial+gmail First hit: http://naelshiab.com/tutorial-send-email-python/ Which sais: [ EDIT: Gmail made some security change change recently. You now have to allow “less secure apps” on your account. Otherwise, you won’t be able to connect to it with your python script. ]

Member Avatar for Lucas_10
0
613
Member Avatar for Tim_10

* You are not adding up the even cubes. You are adding up all cubes of numbers between 0 and natn-1.Look up [range documentation](https://docs.python.org/3/library/functions.html#func-range), how to generate even numbers. * Average is sum divided by count. You can count the numbers by (python3): add = 0 counter=0 for i in …

Member Avatar for tinstaafl
0
381
Member Avatar for Amber_6

I do not understand. * Do you want to draw the maritime flag images using turtle graphics or you want to put the downloaded flag images on a canvas? * What is the expected output of the function?

Member Avatar for slate
0
303
Member Avatar for Pandey_1

python3: import tkinter as tk master = tk.Tk() menu={'pizza':1,'Burger':1,'sandwitch':0} menuvars={} for row, (key, value) in enumerate(menu.items()): menuvars[key]=tk.IntVar() menuvars[key].set(value) tk.Checkbutton(master, text=key, variable=menuvars[key]).grid(row=row, sticky=tk.W) tk.mainloop()

Member Avatar for slate
0
179
Member Avatar for Pandey_1

> How to make panel in tkinter or which widget will be used to hide and show checkbox? I am not sure, I understand this sentence. Something about the keywords "widget" and "hide" http://effbot.org/tkinterbook/pack.htm#Tkinter.Pack.pack_forget-method

Member Avatar for Pandey_1
0
365
Member Avatar for Pandey_1

Line 46: v = IntVar() ** v goes out of scope.** If you bind v to something persistent (self), then it works. How did you plan to read that variable anyway?

Member Avatar for Pandey_1
0
7K
Member Avatar for bob_15

Yes. There is a way to convert it to a GUI based program. Before you do that, I would recommend: * Make a self containained version, so others can run it. That helps you to get help. * Make the program shorter. At first glance the program can be reduced …

Member Avatar for slate
0
721
Member Avatar for zero_1
Member Avatar for engrjd91

Hello there! Short version: I do not understand the question. Long version: My eagle eye detected you posting the [second](https://www.daniweb.com/programming/software-development/threads/504480/python-comparing-two-values-of-lists-) question about the same project. This should be a very secret project. If you would tell us what this is about, we could provide much more help. However your code …

Member Avatar for slate
0
265
Member Avatar for grand_78

Please post a working code, to help others. Try to copy-paste your own posted code into a .py file and see, that it does not work. There is a syntax error, not just intendation problems. The mainloop call is missing, too. I have corrected the code, and hopefully solved your …

Member Avatar for slate
0
233
Member Avatar for Mickey_2

You use global imported variables locally. There is no need to pass ScrolledText and Tk to the Scratchpad class's dunder init. This is redundant. This is the same, but cleaned up: from tkinter import Tk, END, INSERT from tkinter.scrolledtext import ScrolledText from tkinter.filedialog import asksaveasfilename, askopenfilename class Scratchpad: def __init__(self): …

Member Avatar for John_103
0
304
Member Avatar for zero_1

class Date(object): def __init__(self, year, month, day): self.year=year self.month=month self.day=day def __add__(self, other): if not isinstance(other,Delta): raise Exception("can only add Delta object") #FIXME handle the calendar year=self.year+other.year month=self.month+other.month return Date(year,month,self.day) def __str__(self): return "("+",".join(map(str,(self.year,self.month,self.day)))+")" class Delta(object): def __init__(self, year, month): if not (1<=month<=12) or year<0 or \ not isinstance(year,int) or …

Member Avatar for zero_1
0
317
Member Avatar for firdevs

Besides from [whathaveyoutried.com](whathaveyoutried.com) , I can only say: values=[int(input("Give the number(%s): " % i)) for i in range(1,6)] print("Highest: {} \n Lowest: {} \n Average: {}".format(max(values),min(values), sum(values)/len(values))) But beleve me. You should try something.

Member Avatar for slate
0
159
Member Avatar for Mickey_2

I think the most used layout for tkinter is grid. So grid paper and pen. I know, this is not software. [Others](http://stackoverflow.com/questions/14142194/is-there-a-gui-design-app-for-the-tkinter-grid-geometry) recommend that, too.

Member Avatar for slate
0
130
Member Avatar for j.parkerrrr

Here you are. I hope, this makes you a really good programmer. f=open("states.txt").readlines() states=sorted([(f[i].strip(),f[i+1].strip(),int(f[i+2])) for i in range(0,len(f)-3,3)],key=lambda x:x[2]) print("minimum population:",states[0]) print("maximum population:",states[-1])

Member Avatar for slate
-2
363
Member Avatar for Subin raj
Member Avatar for rebekah.stacy1

Python3 nums=[(int(input("Give me the number numero {}: ".format(i+1)))) for i in range(20)] print("Lowest: {}\nHighest: {}\nTotal: {}\nAverage: {}".format(min(nums),max(nums),sum(nums),sum(nums)/len(nums))) I hope that makes you smarter.

Member Avatar for vegaseat
0
528
Member Avatar for sneekula
Member Avatar for rednose00

I suggest to calculate it in a spreadsheet (excel) before you program it. The first x rows will be the conditions, then every row is a date where a payment is due. The columns will be the variables you are using in the program. Let me inform you, that this …

Member Avatar for vegaseat
0
2K
Member Avatar for mark103

This is a horrible post, you have made here. 1. Your code does not run. Bad indent. 2. Are you sure, we need all the data from the database to answer your question? 3. You did not give us the python version you are using. 4. You did not give …

Member Avatar for slate
0
149
Member Avatar for krystosan

There is a script in the python distribution: pythonhome\Tools\Scripts\ftpmirror.py Maybe itt will help you if you look at it.

Member Avatar for slate
0
304
Member Avatar for Ravi_exact

I would create a decorator, that decorates the function. Something like: @menu_item(Name="Save", enabled=True) def save_menu(): function body The decorators would add a dictionary (for example with the name menu_data) to the decorated function with the arguments. The program code would scan the functions and if a function has menu_data attribute, …

Member Avatar for slate
0
487
Member Avatar for geetylerr

You put the space and data coma separated into the text file. So you have no hope of retrieving the fields reliably. You have to make some thoughts how to store and search the data (pickle, shelf, sqlite etc...) Otherwise it is working. Some ideas in the code: import shelve …

Member Avatar for TrustyTony
0
2K
Member Avatar for DawnofanewEra

I am not sure, I understand your problem. These two one liners start a webserver in the current directory. If you point your browser to the localhost, and the port given on the commandline, you will get a directory listing. Python 2.x: python -m SimpleHTTPServer Python 3.x: python -m http.server

Member Avatar for slate
0
495
Member Avatar for dedon4

First of all the program won't run. Line 27,28 have syntax errors. Secondly, if I fix that errors, then the explanation follows: * There is a story, that has 3 parameters. Food, animal and city. * The program asks the user on the command prompt for an example of the …

Member Avatar for slate
0
328
Member Avatar for Hüsnü

You probably have to open the file in binary mode ("wb"). I do not think you have to convert the_page to anything before writing. Otherwise use urlretrieve, as you already found out.

Member Avatar for slate
0
389
Member Avatar for tony75

Can you tell us what exactly do you want to accomplish? Are you sure, do you really want [system programming?](http://en.wikipedia.org/wiki/System_programming).

Member Avatar for slate
0
855
Member Avatar for Fighter01

I have python2 so I changed tkinter to Tkinter. I am not a big tkinter expert. Firstly the code does not work. root.mainloop() or similar is missing. If I put it in, it works. Secondly. If you have created the code, then there was something on your mind, or not? …

Member Avatar for Fighter01
0
965
Member Avatar for varshaholla

You have no values in result_list or in resultlist_key. Try to print out the length of the structures in the matching_image function. Most likely you have a naming conflict. You have global variables that are recreated at the function level.

Member Avatar for varshaholla
0
5K
Member Avatar for nib.nalin

I am not participating just thinking of it a little bit. One approach would be to try to construct an ideal setting, like this: c.... ..... ...** ***** ***** And examine the corner cases, like one row, one columne, too much mines, too few mines etc. Other approach would be …

Member Avatar for slate
0
283
Member Avatar for come_again
Member Avatar for brett.warren.1612

Firstly this is not the mentioned algo. The real one does NOT have an isprime function. That is the main advantage of it. Secondly it is not slowed down. It is slow. If you are interested, we can discuss it. Thirdly look up this algo's implementation here: http://www.daniweb.com/software-development/python/code/217082/eratosthenes-sieve

Member Avatar for slate
0
251
Member Avatar for ZJRG.1997

> Thanks if you've taken an interest but have figured it out: needed to assign a variable to the function. Better formulated: Needed to assign a variable to the function's return value.

Member Avatar for slate
0
265
Member Avatar for Alex_20
Member Avatar for ishaan3731
0
277
Member Avatar for Zahra_1

Your 7th line has an error. You need to convert the output of the input function to int. Not the input function itself. It is an over kill to calculate all the diceroll for all the possible inputs. It is enough to calculate it after the input. No need for …

Member Avatar for Zahra_1
0
4K
Member Avatar for arsh.goyal.98
Member Avatar for Zahra_1

Hello Zahra! I would make a Game class that holds the characters. Then I would make the characters that generates the attributes. The attributes are generated by rolling a dice. Something like this: # python 2 code import random class Dice(object): __slots__=("sides",) def __init__(self,sides): self.sides=sides def roll(self): return random.randint(1,self.sides) class …

Member Avatar for Zahra_1
0
224

The End.