Is anyone doing the assignments for this course? I have just completed ps0, but would appreciate some critique and tips.
Couple things: (somebody please correct me if I'm wrong about any of this, I'm no expert) I'm getting a syntax error with the ">>> " at the beginning of each line. For these assignments, we're supposed to go to File>New Window in the Python Shell (the first window that Idle opens up). This brings us to a blank Notepad-like page. I always start by saving it as ps(number).py because adding the ".py" tells it to keep color-coding everything. Then when you're ready to run the code you have so far, just go to Run>Run Module. So, after removing the ">>> " before each line, we have a program that almost does what the ps0 assignment asks for, and can be easily fixed. The first line is First= ("What is your first name?") this is going to assign the tuple ("What is your first name?") to the variable First (because of the assignment operator, "="). I think instead you want to print the string that is inside the tuple. The same thing goes for the third line. Once you've made those changes, the program will basically be done.
I don't think the assignment with () creates a tuple. Instead, First = ("What's your name",) would create a tuple. Notice the ',' at the end. That being said, I think that for pset0 they asked you to run it in a shell, but I am quite unsure. Your code looks like it is working, but better would be: FAns = raw_input("What's your name?"), you don't need a variable holding that string.
ah yeah, good call, it looks like it assigns the string to the variable First.
Thanks! That was my first program ever - the help and comments are most appreciated!
Hi! I'm doing the assignments too, where are you up to now? You can clean your code up a bit with the following: first = raw_input('What is your first name?\n') last = raw_input('What is your last name?\n') print 'Hello,', first, last
Join our real-time social learning platform and learn together with your friends!