2,646 Posted Topics

Member Avatar for ram_10

We can help, but we cannot do your homework for you. Find the ciphered version of the word `'hello'`, then try to compute it with the dictionary.

Member Avatar for vegaseat
0
251
Member Avatar for Amit_25

It is very difficult to understand how the expected output is connected to the input. Can you explain this ? Also why did you post this in four different forums (python, java, C, C++)? What do you want exactly ?

Member Avatar for sneekula
0
178
Member Avatar for EdJones
Member Avatar for Ben_8
Member Avatar for EdJones

I don't know Runestone Interactive. About languages, my personal opinion is that you are wasting your time learning perl at the same time as python. Both languages can be used for the same tasks and you will end up not using perl because it is older and harder to use …

Member Avatar for Gribouillis
0
152
Member Avatar for ram_10

A regex to match more than 1 space character is r' {2,}' To match a dot followed by a letter without consuming the letter, you can use r'\.(?=[a-zA-Z])' Always use raw strings(`r'...'`) with regexes, in order to preserve `\` characters.

Member Avatar for Gribouillis
0
310
Member Avatar for matrixdevuk

In ubuntu there is a package `python-enum34` for this, together with 3 other enum packages for python.

Member Avatar for matrixdevuk
0
353
Member Avatar for matrixdevuk

You can avoid many calls to `print()` by printing multiline strings such as banner = ''' _____ ____ | ___|__ ___ | __ ) __ _ _ __ | |_ / _ \ / _ \| _ \ / _` | '__| | _| (_) | (_) | |_) | …

Member Avatar for matrixdevuk
0
186
Member Avatar for ram_10

Here is a recursive solution def generate_n_chars(n, c): if n == 0: return '' n, r = divmod(n, 2) s = generate_n_chars(n, c) return s + s + c if r else s + s

Member Avatar for ram_10
0
425
Member Avatar for ram_10

Another solution, using the `any()` builtin function def is_member(x, a): return any(item == x for item in a)

Member Avatar for Gribouillis
0
823
Member Avatar for ram_10

For a string, the following function works def length(s): return 1 + s.rfind(s[-1]) if s else 0 It fails for a list because the list type has no method `rfind()`. The following works for a list def length(alist): x = object() alist.append(x) result = alist.index(x) del alist[-1] return result

Member Avatar for vegaseat
0
194
Member Avatar for stupendousomega

This is a link to a page with windows driver. It seems safer to download them from the [HP web site](http://h10025.www1.hp.com/ewfrf/wc/product?cc=us&lc=en&dlc=en&tmp_geoLoc=true&product=3742086) directly. For linux drivers, I would start [here](http://hplipopensource.com) at hplip web site. This thread is 3 years old, stupendousomega probably found a driver for his printer since then ;)

Member Avatar for Gribouillis
0
493
Member Avatar for tony75

I think you could add a launcher to the explorer's context menu by following [this tutorial](http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/).

Member Avatar for tony75
0
431
Member Avatar for roxie148

I bought three Acer Aspire laptops with i7 and i5 processors. They were sold with windows 8, which I replaced with kubuntu 64 bits and they work very well.

Member Avatar for stultuske
0
254
Member Avatar for MasterHacker110

This page [Click Here](https://en.wikipedia.org/wiki/Numerical_approximations_of_π) contains many formulas. I suggest to start with Ramanujan's formula.

Member Avatar for sneekula
0
351
Member Avatar for YorkshireSpud

Everybody has his/her favorite language. What we lack is an objective criterion to define *the best* language. It's an ill posed problem. You can 1. google what is the best programming language. 2. Think about something else. Python is a very good general purpose language, from a technical point of …

Member Avatar for vegaseat
0
281
Member Avatar for kruko

In this well known page about Sudoku [Click Here](http://norvig.com/sudoku.html), Peter Norvig draws boards of numbers in a console simply by printing convenient strings of characters. Try to print one of his boards, it should give you ideas for your own boards.

Member Avatar for Gribouillis
0
537
Member Avatar for MasterChat

Karl Popper invented the notion of [falsifiability](https://en.wikipedia.org/wiki/Falsifiability) in his extraordinary discussion on the meaning of truth. Following this idea, to make sure that answers are correct, try to refute them by all the means. If they resist all your attempts, you can describe them as correct.

Member Avatar for MasterChat
1
409
Member Avatar for dancks
Member Avatar for prasanna.k

I don't know ESX, but in principle, if you can describe precisely how to do it manually, python should be able to do it.

Member Avatar for Gribouillis
0
905
Member Avatar for JJHT7439
Member Avatar for James_41
0
3K
Member Avatar for misi

Python says `5.16294852309750916500022794327 e287193` and `6.74114012549907340226906510470 e315652`. For example Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from scipy.misc import factorial >>> x = factorial(65536, exact=True) >>> s = str(x) >>> s[-1] '0' >>> s[:30] '516294852309750916500022794327' >>> …

Member Avatar for vegaseat
0
210
Member Avatar for piovertwo

Apparently, there is a fuzzy logic toolbox for Scilab as these links tend to prove * [Item One](https://burubaxair.wordpress.com/2013/09/26/fuzzy-logic-in-scilab-sciflt-part-1-mamdani/) * [Item Two](https://atoms.scilab.org/toolboxes/sciFLT) Scilab is free software under CeCILL license and it is very close to Matlab. There is also a python module called sciscipy to connect python to scilab. Apart from …

Member Avatar for Gribouillis
0
3K
Member Avatar for it@61@sec

Wouldn't that mean storing the master password somewhere in the file system and compromise security ?

Member Avatar for rubberman
0
234
Member Avatar for Auroch

I have a running version for scilab here. I didn't check that the numerical result is good however clear; function func = foo(z, x) func = ((0.6369).*sin(z.*sin(x)).*sin(x)) endfunction function simpson = simpson(f, a, b, n) h = (b-a)/n; i = 0; fks = 0.0; while (i<=n) xk = a+i*h; if …

Member Avatar for Taywin
0
322
Member Avatar for rogwar

Algorithmically, you're reading groups of lines and printing output for this group when it's finished. Pseudo code looks like current_group = None for line in file: group <- extract group from line if group != current_group: # we're starting a new group if current_group is not None: print current_group output …

Member Avatar for rogwar
0
264
Member Avatar for it@61@sec

Here is a python script, if you have python #!/usr/bin/env python # -*-coding: utf8-*- from __future__ import (absolute_import, division, print_function, unicode_literals) __doc__ = ''' ''' import argparse import os def main(args): d = args.directory for n in os.listdir(d): f = os.path.join(d, n) if os.path.islink(f): os.unlink(f) if __name__ == '__main__': parser …

Member Avatar for it@61@sec
0
820
Member Avatar for mcroni

I suggest to uninstall PIL (or pillow) and reinstall Pillow‑2.6.1.win‑amd64‑py3.4.exe from [Gohlke's site](http://www.lfd.uci.edu/~gohlke/pythonlibs/).

Member Avatar for Gribouillis
0
340
Member Avatar for mark103

> I want to print for each title outside of the loop. This is meaningless. It does not matter if the titles are printed inside or outside of the loop (which loop ? why ?) as long as the program prints the correct output. Change your priorities: first the program …

Member Avatar for Gribouillis
0
279
Member Avatar for Chtaylor5201

Use print('{0:.2f}% $ {1:.2f} $ {2:.2f} $ {3:.2f}'.format( ratea, principal, simple, compound)) see [Click Here](https://www.daniweb.com/software-development/python/code/232375/string-formatting-specifications).

Member Avatar for Gribouillis
0
119
Member Avatar for mark103

You can create a list of numbers >>> L = range(4128, 4616) >>> L = [x for x in L if (x-4128) % 70 != 69] >>> L [4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, …

Member Avatar for Gribouillis
0
210
Member Avatar for Muhammad_69

Independently from the python part, I don't understand what you want to do. Can you explain the problem in details.

Member Avatar for sneekula
0
113
Member Avatar for cjohnweb

In CPython, `Socket.recv()` is implemented by calling the C function ssize_t recv(int sockfd, void *buf, size_t len, int flags); You can see this by downloading the python source code and looking into `socketmodule.c`, or online [here](https://hg.python.org/cpython/file/9c35973829e6/Modules/socketmodule.c). Before calling the C function, python allocates a buffer which capacity is bufsize (4096 in …

Member Avatar for Gribouillis
0
1K
Member Avatar for Warrens80
Member Avatar for Slavi
1
398
Member Avatar for valestrom

You can make it a helper function for a function which acts on a full text: def _space_to_tab(work_string): """Replace spaces with tab at the beginning of a line of text """ s_to_tab = 4 whitespace = work_string[ : len(work_string) - len(work_string.lstrip())] whitespace = whitespace.replace(REAL_SPACE * s_to_tab, REAL_TAB) whitespace = whitespace.lstrip(REAL_SPACE) …

Member Avatar for valestrom
0
316
Member Avatar for satyanani40

It means a string representing the file system path to the file or directory `.xsend` in your home directory. A better way to obtain it is os.path.join(os.path.expanduser('~'), '.xsend') This code is better because it is cross-platform.

Member Avatar for Gribouillis
0
174
Member Avatar for lewashby

Sometimes there are errors in a postscript or pdf document. There are several things you can try. If you can open the document with several programs, it may print with one of these programs and not with another. For example a pdf may print from a qpdfview window but not …

Member Avatar for lewashby
0
218
Member Avatar for happygeek
Member Avatar for ITPT

On my computer, I found .tdb files in `~/.config/pulse` and `~/.cache/rhythmbox/album-art`. There is also a module `python-tdb`. I was able to open my tdb files in the python interpreter: import tdb t = tdb.open('foobar.tdb') print(list(t.iterkeys())) Backup your file first :).

Member Avatar for danielpeterson
0
8K
Member Avatar for Odyssey2001

I would use something like this. This code assumes that lines starting with `'` contain values and the other lines are folder lines. def filter(lines): last = None for line in lines: line = line.rstrip() if line.startswith("'"): if last is not None: yield last last = None yield line else: …

Member Avatar for Odyssey2001
0
235
Member Avatar for samuel1991

If you do `>>> help(chr)` in python 3, you get Help on built-in function chr in module builtins: chr(...) chr(i) -> Unicode character Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. Now we can get a set of numbers with >>> s = …

Member Avatar for Gribouillis
0
324
Member Avatar for oussama_1

One of my bad habits is to use the mouse when there is a keyboard shortcut to do the same task. My hand reaches the mouse before my brain has the time to recall the shortcut. This is counterweighted by the good habit of having a mouse on each side …

Member Avatar for Warrens80
1
367
Member Avatar for valestrom

This program may help # -*-coding: utf8-*- __doc__ = ''' ''' import sys S4 = " " * 4 def main(): while True: line = sys.stdin.readline() if not line: break result = line.replace('\t', S4) print(result, end='') if __name__ == '__main__': main()

Member Avatar for Gribouillis
0
5K
Member Avatar for rebekah.stacy1

Start with > Write a program that asks the user to enter a series of 20 numbers. then post your code in this thread :)

Member Avatar for vegaseat
0
528
Member Avatar for ryannnnn

`b64encode()` return a bytes. Convert it to str with decode result = base64.b64encode(username).decode('utf8')+'\n' Notice that `result` has type `str`, while `username` is a `bytes`. I suggest not to use the same variable name in order to avoid type confusion.

Member Avatar for vegaseat
0
303
Member Avatar for fonzali

Try sudo apt-get install trash-cli It works for me in kde, providing commands trash-put trash-empty trash-list restore-trash See [Click Here](https://pypi.python.org/pypi/trash-cli/).

Member Avatar for fonzali
0
235
Member Avatar for muhammadasher

I did not read it, but here is an appetizing guide [Click Here](http://www.tldp.org/LDP/abs/html/)

Member Avatar for Gribouillis
0
177
Member Avatar for flebber

Don't print directly, use strings operations to create new strings with your data instead, for example >>> args = (1,2,3,4) >>> L = [str(n) for n in args] >>> L ['1', '2', '3', '4'] >>> s = '+'.join(L) >>> s '1+2+3+4'

Member Avatar for flebber
0
300
Member Avatar for yeyo_1

The menu logo at the bottom left corner looks like a clover. I search a distro with a clover logo and I found fuduntu linux which has a very similar logo. The colors seem different however.

Member Avatar for Gribouillis
0
326
Member Avatar for Lardmeister

The main drawback of ipython's notebook is its limited editing capabilities. A web browser is far from being as responsive as an IDE and most code editing features are missing.

Member Avatar for bumsfeld
0
296

The End.