On 5/13/14 11:38 PM, Leonardo Petry wrote:
Hi All,
So I am starting with python and I have been working on some simple exercises.
Here is something I found curious about python loops
This loop run each character in a string
def avoids(word,letters):
flag = True
for letter in l
In article <2f08e970-1334-4e7f-ba84-14869708a...@googlegroups.com>,
Leonardo Petry wrote:
> Basically my question is: Why is python not treating the contents of
> [a file] as one long string and looping each character?
Because whoever designed the original file object decided that the right
w
Leonardo Petry writes:
> So I am starting with python and I have been working on some simple
> exercises.
You are welcome here. Congratulations on starting with Python!
You may also be interested to know there is also a separate forum
https://mail.python.org/mailman/listinfo/tutor> dedicated to
In <2f08e970-1334-4e7f-ba84-14869708a...@googlegroups.com> Leonardo Petry
writes:
> fin = open('wordplay.txt');
> user_input = raw_input('Enter some characters: ')
> count = 0
> for line in fin:
> word = line.strip()
> if(avoids(word, user_input)):
> count += 1;
> This is just too
On Wednesday, May 14, 2014 9:08:32 AM UTC+5:30, Leonardo Petry wrote:
>
> This is just too convenient.
>
> Basically my question is: Why is python not treating the contents of
> wordplay.txt as one long string and looping each character?
Did you mean convenient or inconvenient?
Anyways...
Ma
On Tue, May 13, 2014 at 9:38 PM, Leonardo Petry
wrote:
> The loop below (at the bottom) runs each line of the file
>
> fin = open('wordplay.txt');
> user_input = raw_input('Enter some characters: ')
> count = 0
> for line in fin:
> word = line.strip()
> if(avoids(word, user_input)):
>
Hi All,
So I am starting with python and I have been working on some simple exercises.
Here is something I found curious about python loops
This loop run each character in a string
def avoids(word,letters):
flag = True
for letter in letters:
if(letter in word):