- Strength to Increase Rep
- +14
- Strength to Decrease Rep
- -3
- Upvotes Received
- 916
- Posts with Upvotes
- 812
- Upvoting Members
- 325
- Downvotes Received
- 66
- Posts with Downvotes
- 60
- Downvoting Members
- 38
IT Pro doing Eng-Fin-Eng translations
- Interests
- Family values, world peace, translation, Python
- PC Specs
- Asus i7-3770 @ 3.4 GHz, 8 GB, 1.5 TB / TUF Gaming 10th gen laptop
Re: Hint: CODE button must be pushed before pasting code! | |
Re: Paste a piece of code which is unclear to you and we can clarify it's meaning in pseudocode. Do not post externally, but include as normal attachment or preferably just code block. The files in your rar file seemed to be OK, except wrong file types and one of the … | |
Re: Post your code and we will check it out. It is not very hard if you keep your head straight! If you have learned about dictionaries, simplest to operate with is to index dictionary like: board['b2'] or board['b',2] and get user input like: b2, 4 | |
Re: Your display routine is at least too complicated and line 12 does not make sense. Same shorter: [CODE]def count(sticks): print("* %s *" % (sticks * '|')) count(33) [/CODE] Indents of lines 64 and 65 does not make sense. I see for example "How many sticks would you like to pick … | |
Re: [Here](http://matrixprogramming.com/2011/03/linear-solve-in-python-numpy-and-scipy) for example is one example about solving by Gaussian elimination with numpy/scipy with reference to LAPACK libraries. Scipy also has matrix IO routines: http://docs.scipy.org/doc/scipy/reference/tutorial/io.html You might like to install Enthought Canopy Python which has numerous libraries ready installed: https://www.enthought.com/products/canopy/ | |
Re: How about [CODE]now = str(datetime.datetime.now())[/CODE] | |
Re: [code] # program that checks that the username and password are correct # username = input("Please enter your username : ") password = input("Please enter your password : ") print ("Greetings," , username, "you are now logged in now with a password") command = input("Please type a command :") if … | |
Re: n is undefined. I do not understand your int statement. I would index a tuple of the values instezd of nested if.. Sorry but mobile posting is not working at the moment correctly. Could you post the error you are getting and how you are using the function. | |
Re: You are missing essential part calling the main! Otherwise it looks like working, even input is in text window. | |
Re: I do not know pack method so well, but here is how I do it with pack: [CODE]from Tkinter import * import tkFont def killme(): root.quit() root.destroy() root=Tk() dFont=tkFont.Font(family="Arial", size=30) lb=Text(root, width=16, height=5, font=dFont) lb.pack(side=LEFT, fill=BOTH, expand = YES) yscrollbar=Scrollbar(root, orient=VERTICAL, command=lb.yview) yscrollbar.pack(side=RIGHT, fill=Y) lb["yscrollcommand"]=yscrollbar.set root.mainloop() [/CODE] | |
Re: I do not get the problem, only I got not found error from mag function found in code, so I replaced it with distance from origin. I did some renaming to make the program more "PEP8 understandable" [CODE]from __future__ import division from math import * class Point(object): def __init__(self, x=0.0, … | |
Re: OK, here is a really optimized version for this classic problem. This is not originally mine (but have done very similar). It utilizes the fact that primes > 4 are 1(mod 6) or 5(mod 6). Actually I editted it a lot now before posting to be more according to format … | |
Re: So you have not learned the syntax, good place to start to learn it is to go through the tutorial at http://docs.python.org/tutorial/index.html | |
Re: I would prefer to have functions themselves as first value and just call it instead of using eval. be sure to rename the functions according to choice. Best naming would be to use verb and if need to join words in name use _. Do not use capital letters. | |
Re: That is because unnecessary update of the screen weakens the quality of the display. Maybe not, or only with slower computer, but it is good practice to avoid unnecessary refresh. Especially when you do more action on screen than just changing number. | |
Re: Please include the error messages. The variable must of course be global variable in the python file. At least saving the value to text file to be read by the script should work. | |
Re: Value of words will be the method for splitting strings. Maybe that is not what you want. | |
Re: Gribouillis means that obviously those two functions have no business in being in the class Player. Interestingly I have exactly same functions in module called games for a Blackjack game from one book, without the class Player. in range(low, high) is not the world's most efficient way to check value … | |
Re: Why you are not calling the mainloop at last line? Shouldn't the parameter to parent init be self? | |
This is one small snippet of after event usage. You could express if you find this kind of simple code to be usefull as snippet. Notice also vegaseat's sticky message threads in begining of Python forum in addition to code snippets. | |
Re: Agreed, WaltP. As example, here is what Code::Blocks AStyle plugin makes out of your code #include<iostream> #include<cstdio> #include<conio.h> using namespace std; int weight[20][20],visited[20],d[20],p[20]; int v,e; void creategraph() { int i,j,a,b,w; cout<<"Enter number of vertices: "; cin>>v; cout<<"\nEnter number of edges: "; cin>>e; for(i=1; i<=v; i++) for(j=1; j<=v; j++) weight[i][j]=0; for(i=1; … | |
Re: What was the best program you have done this far? Of course you have to do some kind of design of the program algorithm first and be able to do the task yourself and able to list all steps of it before teaching the computer to do it. Are you … | |
Re: Are you sure that you initialize the midi system like in this snippet before playing the file? | |
Re: Everything should work as long as you replace the print command with print function, manually or by 2to3. More shortly: [CODE]# find the last line, change to a file you have with open('test.txt') as myfile: print (list(myfile)[-1]) [/CODE] | |
Re: Of course it could be considered user responsibility, but I do not personally like that the calculator does not allow to continue from result and saves formula to memory instead of evaluating the result automatically. For example: 10/3 M-> = result: 3.333333 * M<- = result: *10/3.0first char not in … | |
Re: Is that 3.2 3.2.2 as there was an issue with input statement with 3.2.1? Probably not reason though, at that problem would make program OK in IDLE and not OK in direct excecution. | |
Re: Good luck, we are always ready to help, you only have to post in your code and explain where you have difficulty. | |
Re: Are you sure you need while for this job. BTW it has no else part not to talk about elif. And in you new version while condition is always True as <condition> or -2 is always True. | |
Re: Would it maybe easier to use my code snippet for text file based database (actualy card file would be more proper term) | |
Re: M+ does addition to existing contents in memory, MS stores there [CODE] M+ =+ MS =[/CODE] |