Small correction.
file_path = "C:/Users/Rafael/PythonCode/PiDigits.txt"
with open(file_path) as a:
b = a.read()
get_year = input("What year were you born? ")
count = 0
b= '3'+b[2:]
n = len(b)
for i in range(n-3):
if b[i:i+4] == get_year:
count += 1
print("Your birth date occurs %
On 04/04/17 00:37, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> I will go for this modification of the original code.
> count = 0
> b= '3'+b[2:]
> n = len(b)
> for i in range(n-4):
> if b[i:i+4] == get_year:
> count += 1
While I think this works OK, I would probably suggest
that this is one of
I will go for this modification of the original code.
file_path = "C:/Users/Rafael/PythonCode/PiDigits.txt"
with open(file_path) as a:
b = a.read()
get_year = input("What year were you born? ")
count = 0
b= '3'+b[2:]
n = len(b)
for i in range(n-4):
if b[i:i+4] == get_year:
count
On 03/04/17 19:43, Ed Manning wrote:
> untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example
> 172.20.2.3/28"'':')
> while not ipaddress.ip_network untrust_ip_address:
Doesn't that give a syntax error?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http
Hello there,
>what am I going wrong here? i need to validate this is an IP or ask
>the question again
>
>untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example
>172.20.2.3/28"'':')
This is a representation of an IP address along with the mask length for the
prefix:
172.20.2.3/28
Quang nguyen writes:
> I would like to open the script in Terminal with several extra
> pictures which be called inside the script.
I think by “Terminal” you mean the text-only terminal emulator.
By definition, then, a text-only terminal is not going to display
graphic images.
So, can you expl
Hi guys,
I would like to open the script in Terminal with several extra pictures
which be called inside the script.
I tried to open in Terminal, but it gave me trouble about where is the
location of my pictures.
Thank you for time.
___
Tutor maillist
On 04/03/2017 05:36 AM, Peter Otten wrote:
Stephen P. Molnar wrote:
I am trying to port a program that I wrote in FORTRAN twenty years ago
into Python 3 and am having a hard time trying to calculate the
Euclidean distance between each atom in the molecule and every other
atom in the molecule.
On 04/03/2017 10:16 AM, Alan Gauld via Tutor wrote:
> On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
>> Sorry. That was stupid of me. The loop does nothing.
>
> Let me rewrite the code with some different variable names...
>
with open(file_path) as a:
b = a.read()
>
> with o
Hello
what am I going wrong here? i need to validate this is an IP or ask the
question again
untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example
172.20.2.3/28"'':')
while not ipaddress.ip_network untrust_ip_address:
untrust_ip_address = raw_input('\nEnter the untrus
On 04/03/2017 04:20 AM, Alan Gauld via Tutor wrote:
> On 03/04/17 05:34, Quang nguyen wrote:
>
>> I do not know how to run my python 3 script after my PI2 finished startup.
>
> This might be a better question for a PI forum since it doesn't
> seem to have anything directly to do with Python.
>
>
On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Sorry. That was stupid of me. The loop does nothing.
Let me rewrite the code with some different variable names...
>>> with open(file_path) as a:
>>> b = a.read()
with open (file_path) as PI_text:
PI_as_a_long_string = PI_text.read
On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Sorry. That was stupid of me. The loop does nothing.
>
On the contrary, the loop does an awful lot, just
not what the OP was expecting.
>>> with open(file_path) as a:
>>> b = a.read()
>>> for year in b:
>>> if get_year in b:
>>>
Sorry. That was stupid of me. The loop does nothing.
regards,
Sarma.
On Mon, Apr 3, 2017 at 8:44 PM, Alan Gauld via Tutor
wrote:
> On 03/04/17 16:07, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> > Modifying the code as shown below may work.
>
> I doubt it.
>
> > with open(file_path) as a:
> > b
On 03/04/17 16:07, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Modifying the code as shown below may work.
I doubt it.
> with open(file_path) as a:
> b = a.read()
>
> get_year = input("What year were you born? ")
>
> count = 0
> for year in b:
Once more I ask, what does this loop do?
> if get
Modifying the code as shown below may work.
file_path = "C:/Users/Rafael/PythonCode/PiDigits.txt"
with open(file_path) as a:
b = a.read()
get_year = input("What year were you born? ")
count = 0
for year in b:
if get_year in b:
count += 1
print("Your birth date occurs %s times in
On 03/04/17 13:22, Rafael Knuth wrote:
> with open (file_path) as a:
> b = a.read()
>
> get_year = input("What year were you born? ")
>
> for year in b:
Can you explain what you think this loop line is doing?
I'm pretty sure it's not doing what you expect.
> if get_year in b:
>
I wrote a program which checks if PI (first one million digits)
contains a person's birth year.
file_path = "C:/Users/Rafael/PythonCode/PiDigits.txt"
with open (file_path) as a:
b = a.read()
get_year = input("What year were you born? ")
for year in b:
if get_year in b:
print("Yo
On 03/04/17 05:34, Quang nguyen wrote:
> I do not know how to run my python 3 script after my PI2 finished startup.
This might be a better question for a PI forum since it doesn't
seem to have anything directly to do with Python.
> the easy way to run at startup with escape plan?.
You will nee
Stephen P. Molnar wrote:
> I am trying to port a program that I wrote in FORTRAN twenty years ago
> into Python 3 and am having a hard time trying to calculate the
> Euclidean distance between each atom in the molecule and every other
> atom in the molecule.
>
> Here is a typical table of coordin
Hi guys,
I do not know how to run my python 3 script after my PI2 finished startup.
I searched about it on some websites, and I feel so confused. Anyone know
the easy way to run at startup with escape plan?. I am afraid that it will
be a looping trap if I do not have escape plan :)
Thank you
___
Dr. Molnar:
This might be your solution:
>>> import numpy
>>> a = numpy.array((-3.265636, 0.198894, 0.090858))
>>> b = numpy.array((-1.307161, 1.522212, 1.003463))
>>> dist = numpy.linalg.norm(a-b)
>>> dist
2.5337013913983633
>>>
Qiao Qiao
> On Apr 2, 2017, at 1:41 PM, Stephen P. Molnar wr
Hi Stephen-
The `scipy.spatial.distance` module (part of the SciPy package) contains
what you will need -- specifically, the `scipy.spatial.distance.pdist`
function, which takes a matrix of m observations in n-dimensional space,
and returns a condensed distance matrix as described in
https://docs.
23 matches
Mail list logo