fork(1) download
  1. from: Emily K Smalls
  2. post: Hello! So I'm trying to do HW3, and I am having some trouble running my program in the terminal. When I did it gave me completely different input than i was getting in the console: me@me-virtual-machine ~/System/release/hw/3 $ python2.5 hw3.py 0 8 24 48 80 the last value of x was 9 ---------- 0 words 0 characters 0 lines Does anyone know why this might be?
  3. from: Paul Resnick
  4. comment: Can you post screenshots of it running in both places?
  5. from: Emily K Smalls
  6. comment: I was able to fix the mistake!
  7. from: Emily K Smalls
  8. post: Also...on #5 of part II, the replace question, I'm getting an error: I wrote.. hello = lst.replace('5','five') print hello but it gives me an AttributeError: 'list' object has no attribute 'replace'? I also cannot run lst.find without getting an error?
  9. from: Noah James Hermann
  10. comment: replace only works with strings, so make list into a string with str() function. then you can replace it.
  11. from: Emily K Smalls
  12. comment: Thank you!
  13. from: Lance Cummins
  14. comment: You can also directly change that element in the list with something like lst[2] = 'five'
  15. from: Noah James Hermann
  16. comment: thats probably a better method
  17. from: Paul Resnick
  18. comment: Noah is right that replace only works on strings and Lance is right that you can do assignment to list elements. (And thanks, Lance, for making her think instead of just giving her the answer. 2 is just a sample list index there, not the correct one.)
  19. from: Paul Resnick
  20. comment: Suggestion for posting requests about errors in the future: post the error message. In this case, the error message is: Traceback (most recent call last): File "/home/me/System/release/hw/3/hw3.py", line 12, in <module> hello = lst.replace('5','five') AttributeError: 'list' object has no attribute 'replace' This error message actually tells you which line has a problem, and why: replace doesn't work on lists!
  21. from: Jaeyoon Yoo
  22. post: Hi guys I am doing hw3 part II #3 and my code is: for loop in s: print s.split() But I cannot get the same result from the screenshot of hw3 ... what did I do wrong?
  23. from: Paul Resnick
  24. comment: Please check out slides 3 and 4 from Tuesday 1/17 lecture. As you've written it, in the first line you have used loop as the varname. So the second line (if you indent it) will execute once for each character in s, each time with the variable loop bound to a different character from s. Each time it will split s and print out the whole list. Try stepping through it in the debugger to see. With that explanation of what your current code is doing, can you see a way to do what you're trying to do? (Hint: you don't want to iterate through the characters in s; you want to iterate through the items in the list produced by splitting s.)
  25. from: Lauren Fisher
  26. post: okay, I feel like all my questions are really dumb on here, so i apologize everyone. but i have a dell what do i get? there's the player which i think i have but then there are the 3 different workstations. will someone please help me :)
  27. from: Paul Resnick
  28. comment: If you have a Dell, you're running the Windows OS. If you are using VWMware player, you don't need to do anything, because it's already a free forever license for everyone. If you are using VMWare desktop, then you should follow a download process but stop before downloading and just copy the serial number, like what Joe Lucas described in his instructions for Fusion for the Mac.
  29. from: Joe Lucas
  30. post: I got the the VMware license working and Prof. Resnick requested I post what it looks like. I followed the link in the email, signed up, bought VMware fusion, got to the screen on the right, and copied and pasted the number into the window on the left (under VMware Fusion> Buy Now or Enter License...). As you can see my evaluation period is now 410 days instead of 30 days.
  31. from: Jen Eisenberg
  32. comment: thank you - that was very helpful!!
  33. from: Jenny Kim
  34. post: For VMWare Fusion, I just got access to a license but I was wondering if I should re-download it or just type the serial number in. Thanks!
  35. from: Paul Resnick
  36. comment: Looks like just typing pasting in the serial number works. See Joe Lucas' screenshot.
  37. from: Jenny Kim
  38. comment: oh, i didn't see that thank you!
  39. from: Paul Resnick
  40. comment: Actually, he posted it after your original post!
  41. from: Jackie Cohen
  42. post: As Chris pointed out below: in Part II and Part III of HW3, you should look at the instructions in hw3.py, not hw2.
  43. from: Chris Paul
  44. post: For Part II and Part III of homework 3, I am guessing it is the instructions in hw3.py?
  45. from: Jackie Cohen
  46. comment: Yes! Sorry about that.
  47.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty