[Tutor] Does anyone here has the problems of CS231 saved?

2015-02-15 Thread Anubhav Yadav
I used to solve the programming problems of the CS231 course of the
Michigan State University, they had many python programming problems listed
on a website [1].

Now suddenly the website seems to be down and I was wondering if anyone has
a local copy of this problems with them and is willing to share with me?

There were about 10-12 good problems each on topics on the following
concepts:
1) First Steps
2) Control statements
3) Working with strings
4) Functions
5) List and tuples
6) Dictionaries and sets
7) Classes and Class Designs

And the problems were nicely mixed with concepts from gui programming, game
programming, they used modules like turtle graphics etc. There even used to
concepts from natural language processing or information retrieval.

So if someone does have a copy of the all the examples, please share it
with me. There used to be a pdf for each problem statement clearly
explaining what needs to be done with the examples. So I wonder if someone
has saved all the pdf's it would be really helpful. There is also a cached
version of the website [2]. But I am not able to access the problem links
in the cached contents.

Worst case if no one has a copy to all the examples, can someone suggest me
a different website with python programming assignments for the same
purpose?

Thank you.

[1] http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/
[2]
http://webcache.googleusercontent.com/search?q=cache:http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/
-- 
Regards,
Anubhav Yadav
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Does anyone here has the problems of CS231 saved?

2015-02-15 Thread Peter Otten
Anubhav Yadav wrote:

> I used to solve the programming problems of the CS231 course of the
> Michigan State University, they had many python programming problems
> listed on a website [1].
> 
> Now suddenly the website seems to be down and I was wondering if anyone
> has a local copy of this problems with them and is willing to share with
> me?


Looks like the Internet Archive has a copy from 2013-Jun-23:




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Does anyone here has the problems of CS231 saved?

2015-02-15 Thread Anubhav Yadav
>
> Looks like the Internet Archive has a copy from 2013-Jun-23:
>
> <
> https://web.archive.org/web/*/http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/
> >
>
>
>
Thanks a lot. That helps a lot. Although the problems are very less in
comparison to the ones that were latest, I think I can do with it.
Thanks again.



-- 
Regards,
Anubhav Yadav
KPIT Technologies,
Pune.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sql-like join on two lists or dictionaries

2015-02-15 Thread Peter Otten
Joel Goldstick wrote:

> You can dispense with the slicing if you use the str.split() method.  It
> will put each item in a list.

Only if there are no whitespace chars in the field.

OT: 

Joel, your comments are already quoted when you first post them. Something 
is broken in your workflow.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sql-like join on two lists or dictionaries

2015-02-15 Thread Peter Otten
Alan Gauld wrote:

> On 14/02/15 09:55, Peter Otten wrote:
> 
>> with open(headerfile) as f:
>>  lookup_header = {
>>  headerdata[:6]: headerdata.rstrip("\n") for headerdata in f}
>>
>> Then you can iterate over the lines in linefile, extract the key from
>> that and look it up in the dict:
>>
>> with open(linefile) as lines, open("hl.dat", "w") as joined:
>>  for line in lines:
>>  try:
>>  header = lookup_header[line[:6]]
>>  except KeyError:
>>  header = ""
>>  print(line.rstrip("\n"), header, sep="", file=joined)
>>
> 
> The try/except could be written more concisely as
> 
> header = lookup_header.get(line[:6], "")

Yep, I originally had something like

for line in lines:
try:
header = lookup_header[line[:6]]
except KeyError:
contine
print(...)

in mind.

By the way, the 

print(..., sep="", ...) # no idea why I did this

is wrong and should be omitted. Also, you (OP) probably don't want the key 
column to appear twice in the output, so the second occurence can be sliced 
off:

print(line.rstrip("\n"), header[6:], file=joined)


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Help with Program

2015-02-15 Thread Tina Figz
I'm having a problem with my program and I'm not sure how to correct it
(I'm in an intro programming class).

My program is supposed two numbers and count the number of carry
operations.

This is what I have:

n1 = int(raw_input('Number #1: '))
n2 = int(raw_input('Number #2: '))
add = n1 + n2
print ' '
print n1, '+', n2, '=', add
print ' '
sn1 = str(n1)
sn2 = str(n2)
num1 = 1
num2 = 1
num1 == num2
last_n1 = sn1[-num1]
last_n2 = sn2[-num2]
int_lastn1 = int(last_n1)
int_lastn2 = int(last_n2)
eq = int_lastn1 + int_lastn2
carry = 0
while eq >= 10 and carry < len(sn1) and carry < len(sn2):
num1 += 1
num2 += 1
carry += 1
print 'Number of carries:', carry

When I input 239 & 123 as my two numbers it equals 362, which is correct.
But it says I have 3 carries, when the answer should be 1 carry operation.

I'm not sure how to correct this error.

Thanks,

Taylor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor