Re: [Tutor] Python 3.5 Question

2015-10-09 Thread Ben Finney
Mark Lawrence writes: > On 09/10/2015 16:47, Ben Finney wrote: > > Whoops, my apology! I failed to notice we are already in that forum > > :-) > > I simply had to roar with laughter at the signature you used for the > above as it just seemed so apt, nothing personal :) > > > \ “He may look

Re: [Tutor] Python 3.5 Question

2015-10-09 Thread Mark Lawrence
On 09/10/2015 16:47, Ben Finney wrote: Ben Finney writes: You may also be interested in the Python Tutor forum https://mail.python.org/mailman/listinfo/tutor> which is specially focussed on collaboratively teaching Python beginners. Whoops, my apology! I failed to notice we are already in th

Re: [Tutor] How to read all integers from a binary file?

2015-10-09 Thread Martin A. Brown
Hello there David, I have a binary file of 32-bit unsigned integers. I want to read all those integers into a list. I have: ulData = [] with open(ulBinFileName, "rb") as inf: ulData.append(struct.unpack('i', inf.read(4))) This obviously reads only one integer from the file. Ho

Re: [Tutor] How to read all integers from a binary file?

2015-10-09 Thread Laura Creighton
In a message of Fri, 09 Oct 2015 15:02:20 -, David Aldrich writes: >Hi > >I have a binary file of 32-bit unsigned integers. I want to read all those >integers into a list. > >I have: > >ulData = [] >with open(ulBinFileName, "rb") as inf: >ulData.append(struct.unpack('i', inf.re

Re: [Tutor] How to read all integers from a binary file?

2015-10-09 Thread Peter Otten
David Aldrich wrote: > Hi > > I have a binary file of 32-bit unsigned integers. I want to read all those > integers into a list. > > I have: > > ulData = [] > with open(ulBinFileName, "rb") as inf: > ulData.append(struct.unpack('i', inf.read(4))) > > This obviously reads only o

[Tutor] How to read all integers from a binary file?

2015-10-09 Thread David Aldrich
Hi I have a binary file of 32-bit unsigned integers. I want to read all those integers into a list. I have: ulData = [] with open(ulBinFileName, "rb") as inf: ulData.append(struct.unpack('i', inf.read(4))) This obviously reads only one integer from the file. How would I modify

Re: [Tutor] Help with else

2015-10-09 Thread Enes Unal
may be this one? name = raw_input("What is your name") print "Great! Now %s, are you a boy or a girl?" % (name) gender = raw_input("") if gender == "boy": print " I can see that, you are very strong" elif gender == "girl": print ' Yes, and a beautiful one' else: print "Y

Re: [Tutor] Python 3.5 Question

2015-10-09 Thread Ben Finney
Ben Finney writes: > You may also be interested in the Python Tutor forum > https://mail.python.org/mailman/listinfo/tutor> which is specially > focussed on collaboratively teaching Python beginners. Whoops, my apology! I failed to notice we are already in that forum :-) -- \ “He may look

[Tutor] How to write a teller machine simulation, was Re: Python 3.5 Question

2015-10-09 Thread Peter Otten
Sasuke Uchiha wrote: > Hi, I would like to know how to create a code similar to the result below. > I want to input a number like 1000, and for it to give me the maximum > output with the least amount of bills (such as 100s) > >- > >The bill amounts you have are 100s, 50s, 20s, 10s, 5s,

Re: [Tutor] Python 3.5 Question

2015-10-09 Thread Alan Gauld
On 09/10/15 01:13, Sasuke Uchiha wrote: Hi, I would like to know how to create a code similar to the result below. I want to input a number like 1000, and for it to give me the maximum output with the least amount of bills (such as 100s) This looks like homework and we won't do your homework f

Re: [Tutor] Python 3.5 Question

2015-10-09 Thread Ben Finney
Sasuke Uchiha writes: > Hi, I would like to know how to create a code similar to the result > below. Is this an assignment for you? We aren't a service to do homework. Can you show some code you have written to try solving the problem? We can discuss what you have already tried. You may also b

Re: [Tutor] Help with else

2015-10-09 Thread Alan Gauld
On 09/10/15 04:31, Nick Brodsky wrote: name = raw_input("What is your name") print "Great! Now %s, are you a boy or a girl?" % (name) gender = raw_input("") if gender == "boy": print " I can see that, you are very strong": if gender == "girl": print ' Yes, and a beautiful one': else:

[Tutor] Python 3.5 Question

2015-10-09 Thread Sasuke Uchiha
Hi, I would like to know how to create a code similar to the result below. I want to input a number like 1000, and for it to give me the maximum output with the least amount of bills (such as 100s) - The bill amounts you have are 100s, 50s, 20s, 10s, 5s, and 1s - >>> Please enter

[Tutor] Help with else

2015-10-09 Thread Nick Brodsky
name = raw_input("What is your name") print "Great! Now %s, are you a boy or a girl?" % (name) gender = raw_input("") if gender == "boy": print " I can see that, you are very strong": if gender == "girl": print ' Yes, and a beautiful one': else: print "Your choice" I don't understand why

Re: [Tutor] Updating index of a list

2015-10-09 Thread Anshu Kumar
Hi Andrea, You can use lambda or list comprehension to solve your problem in one step. I am more comfortable with lambda so will explain that way. Please follow below lines of code. andreea_list = [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', '99']] andrea