membership, or when you can take advantage
of set operations, like union or symmetric difference.
If your list of chickens is unordered and has no duplicates,
using a set instead is often a good refinement.
--
Neil Cerutti
___
Tutor maillist - Tutor@
uot;SuperLion", "Cow", "Panda"]
You can perform the whole operation with a single list
comprehension.
animals_lol = [[a, len(a)] for a in animals]
Which is shorthand for the following loop:
animals_lol = []
for a in animals:
animals_lol.append([a, len(a)])
--
Ne
On 2018-06-13, Niharika Jakhar wrote:
> hi everyone!
> I am working with a tsv file which has NA and empty values.
> I have used csv package to make a list of list of the data.
> I want to remove NA and empty values.
Should the the data 40 50 NA 12 mean the same thing as 40 50 1
d dashes, both
of which could be considered parts of words.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ght in fact be
> some behaviour that these login records might acquire within
> the system. For example formatted printing, comparisons between
> records etc etc.
Excellent point! At the very least, such classes usually gain the
ability to build themselves with an __init__ method, w
tal
> molecular weight.
>
> Convert between temperature scales (degrees Celsius, Fahrenheit, and
> Kelvin).
Excellent suggestions.
It could also be fun to build a text-based solitaire program of
your choice.
--
Neil Cerutti
___
Tuto
On 2018-04-13, David Rock wrote:
>
>> On Apr 13, 2018, at 09:24, Neil Cerutti wrote:
>>
>> On 2018-04-12, Scharrer, Brianna wrote:
>>> Applications of basic language syntax
>>>
>>> Date/time string parsing
>>>
>>> Time stamp
discussed) I recommend using a dictionaries for conversion,
rather than if statements, if you're allowed.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 2018-03-30, Stefan Behnel wrote:
> Neil Cerutti schrieb am 30.03.2018 um 15:50:
>> On 2018-03-30, Stefan Behnel wrote:
>>> I admit that I'm being a bit strict here, there are certainly
>>> cases where parsing the namespace from a tag is a sensible
>>>
reconsidering (or
> asking) if you are doing the right thing.
Namespaces hurt my head when I try to imagine a use for them. The
only one's I've encountered are just applied to an entire
document, making parsing more inconvenient but providing no ot
l-formed?
That's sounds like a fun and challenging problem.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ve finite representations in
decimal notation.
For your specific problem, you can use Python's format function,
for example:
>>> for i in range(1, 11):
print('{:.4f}'.format(1 / i))
1.
0.5000
0.
0.2500
0.2000
0.1667
0.1429
0.1250
0.
0.1000
--
Neil Ceru
ist independently of their
parent. In other words, in the text aggregation is a
generlisation of composition.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
hing the query
into a separate function is a good way to eliminate the verbatim
repetition of code.
def get_query():
return input("Please type in your question(press 'Enter' to exit):")
In main:
query = get_query()
while query
On 2017-10-19, Alan Gauld via Tutor wrote:
> On 18/10/17 21:09, Albert-Jan Roskam wrote:
>>
>> On Oct 16, 2017 15:12, Neil Cerutti wrote:
>
>>> sqlite3 module. In sqlite modifying table definitions is limited
>>> to the simple addition of a new row of da
our main goal,
at first, should be to stick with standard SQL as much as you
possibly can, to make it easier to switch database engines should
you ever wish to do so.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Sometimes I use classes simply because it provides a convenient
way to organize the project's functions.
This crops up sometimes when I'm translating some data into
another form. Every object translates into itself.
--
Neil Cerutti
___
Tu
On 2017-08-16, boB Stepp wrote:
> On Tue, Aug 15, 2017 at 12:29 PM, Alan Gauld via Tutor
> wrote:
>> On 15/08/17 15:09, Neil Cerutti wrote:
>>>> There are a variety of reports that I would like to be able
>>>> to print to screen or paper. Things such as
ason why my
> two dictionaries cannot be manipulated to pull the desired
> results for each imagined type of report.
You really can do it, but to me this requirement argues for going
back to a database backend. Why rewrite SQL?
--
Neil Cerutti
___
Tuto
t;:
> ... return "Celsius"
> ... return "unknown"
> ...
>>>> check("c")
> 'Celsius'
>>>> check("C")
> 'Celsius'
>>>> check("F")
> 'unknown'
>
>
n-strings
> cases.
Composing a FSA (finite state automata) by hand would be an
excellent exercise in addition to covering the overlapping cases.
Another fun exercise might be to find the bithdays using
arithmetic operations instead of string operations.
--
Neil Cerutti
think-about test cases, and slowly build them up.
Do not try to debug by starting with a typical case.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
> x
range(0, 100)
You can use slice notation on range objects.
>>> x[::10]
range(0, 100, 10)
So we've got *that* going for us.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
eceive* attachments is a
> major failure.
I'm living in the past, man!
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ver tool you are
> using to read this mailing list, or at least to change your
> assumption when you see a contentless message from "Original
> poster didn't send email" to "I can't see the email".
This is also a USENET newsgroup, where attachements are not a
your help.
It's because fib(0) never terminates.
The fibonacci numbers should start with (1, 1, 2) i.e., fib(0)
ought to return 1, with the rest of your algorithm adjusted
accordingly.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
on it. If not, it's just inviting needless headaches.
--
Neil Cerutti
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
27 matches
Mail list logo