On Fri, 17 Aug 2018 at 09:38, Matthew Polack
wrote:
>
> We're enjoying learning Python in our school...but I have a question
> regarding the way the end users should ideally run the software.
>
> Does this always require Python being installed as a full language on the
> end users computer?
It's
On 22/08/18 17:27, Mats Wichmann wrote:
> I'm really unfond of accessing members of a collection by numeric index.
>
> >>> numer, denom = d["twothirds"]
> >>> print(numer, denom)
> (2, 3)
>
> I think that's nicer than: numer = d["twothirds][0]
You can alsao avoid indexes with the namedtu
On 08/21/2018 04:27 PM, Roger Lea Scherer wrote:
> So I'm trying to divide fractions, technically I suppose integers. So, for
> instance, when the user inputs a 1 as the numerator and a 2 as the
> denominator to get the float 0.5, I want to put the 0.5 as the key in a
> dictionary and the 1 and the
On 22/08/18 15:45, JGledhill via Tutor wrote:
> I'm at the point where I want to actually start "programming",> and solving
> problems by thinking through them, not just copying code
examples.
Well done, it's good to recognise that stage in your development.
> Any recommendations on how I can b
Greetings,
I am at a point where I am familiar with variables, "if", "while", "for",
statements etc, as well as the basics of object oriented programming. Up to
this point I've mostly been following tutorials, which involves a lot of hand
holding. I'm at the point where I want to actually start
On Tue, Aug 21, 2018 at 03:27:46PM -0700, Roger Lea Scherer wrote:
> I want to put the 0.5 as the key in a
> dictionary and the 1 and the 2 as the values of the key in a list {0.5: [1,
> 2]}, hoping to access the 1 and 2 later, but not together.
Let's do some experimentation. Here's a list:
py>
On Tue, Aug 21, 2018 at 03:27:46PM -0700, Roger Lea Scherer wrote:
> So I'm trying to divide fractions, technically I suppose integers.
Python has a library for doing maths with fractions. Unfortunately it is
considerably too complex to use as a learning example, but as a
practical library for
On 22/08/18 11:29, Rafael Knuth wrote:
> my code below did not require a return statement, hence I was assuming
> it wouldn't be needed in my function either.
return is only used inside a function, it makes no
sense outside (and is a syntax error). Its purpose
is to return a value to the caller o
On 22/08/2018 07:46, Rafael Knuth wrote:
import pandas as pd
cities_lst = pd.read_table("cool_cities.csv")
cities_lst.head()
I was trying to rewrite the above as a function.
Unlike my code above, my function below did not return the first 5
rows, but just nothing:
def cities(file_name):
> You are not returning anything.
> You need to use the return keyword otherwise your
> function just generates the data internally then
> throws it away again.
ok, got it - thanks.
my code below did not require a return statement, hence I was assuming
it wouldn't be needed in my function either.
On 21/08/18 23:27, Roger Lea Scherer wrote:
> I can't find anything in StackOverflow or Python documentation specifically
> about this. They talk about accessing a list or a tuple or a dictionary,
> but not when the value is a tuple or list.
The value is irrelevant youi access the value in
exactl
On 22/08/18 07:46, Rafael Knuth wrote:
> import pandas as pd
> cities_lst = pd.read_table("cool_cities.csv")
> cities_lst.head()
>
> I was trying to rewrite the above as a function.
> Unlike my code above, my function below did not return the first 5
> rows, but just nothing:
>
> def cities(file_
On 22/08/2018 07:46, Rafael Knuth wrote:
import pandas as pd
cities_lst = pd.read_table("cool_cities.csv")
cities_lst.head()
I was trying to rewrite the above as a function.
Unlike my code above, my function below did not return the first 5
rows, but just nothing:
def cities(file_name):
So I'm trying to divide fractions, technically I suppose integers. So, for
instance, when the user inputs a 1 as the numerator and a 2 as the
denominator to get the float 0.5, I want to put the 0.5 as the key in a
dictionary and the 1 and the 2 as the values of the key in a list {0.5: [1,
2]}, hopi
import pandas as pd
cities_lst = pd.read_table("cool_cities.csv")
cities_lst.head()
I was trying to rewrite the above as a function.
Unlike my code above, my function below did not return the first 5
rows, but just nothing:
def cities(file_name):
import pandas as pd
cities_lst = pd.read_t
15 matches
Mail list logo