-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change python intro to use files #210
Conversation
|
||
With the file saved, it's time to run it! Using the skills you've learned in the command line section, **change directories** to the desktop and then use Python to execute the code in the file like this: | ||
|
||
$ python3 python_intro.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here we need to make sure that they are in the right directory (desktop) or tell them how to go to this directory (they learned cd
commands in intro to command line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I wasn't sure if they fully understood this yet. Better to be explicit here. I'll make a change.
Thanks for this awesome contribution @phalt! Really well done. I am nitpicking on two things, what do you think? @bmispelon it'd be awesome if you would have 10 minutes to see if I missed something :) |
|
||
Earlier, we picked out a code editor from the [code editor](code_editor/README.md) section. We'll need to open the editor now and write some code into a new file: | ||
|
||
print('Hello, Django girls!') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked through the entire tutorial, but as far as I can remember we use double quotes "
for string most the time. This would reduce confusion if we stick to them here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it looks like a lot of the tutorial uses single quotes. Happy to change it. Can we get a definitive on this please @olasitarska? Single or double quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we haven't ever made that decision. Can you check what this chapter is using and adjust to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My general guideline is: single quotes for machine-readable strings and double quotes for human readable ones.
It might be nice to be more consistent about this through the tutorial but I think that's out of scope for this PR.
Also note that we do explain the two syntax at the beginning of this chapter and in my exprience, I haven't seen much confusion about this in practice.
I will give this a thorough review later in the evening. Thanks for tackling this, Paul. Much appreciated ❤️ |
|
||
Awesome, right? This way you don't have to repeat yourself every time you want to change the name of the person the function is supposed to greet. And that's exactly why we need functions - you never want to repeat your code! | ||
Now what do you think will happen if you write another name in there? Give it a try and see if you're right! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be before the previous paragraph?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleared this up, it should print out "Hi anonymous" this time, but I can see why there was confusion.
I left a few comments here and there but this is a really awesome contribution! As I mentionned in #210, I think we could switch to file-based execution right before we introduce the Thanks again! |
Updates should have been pushed up now:
|
Change python intro to use files
Thank you! 💖 |
Yay! ✨ 🎉 |
😄 |
Changes to the Python Introduction chapter to use files when things get more complex.
This reshuffles the code editor chapter to between the Python installation and Python introduction chapters.
Reading through the tutorial, it felt like the interpreter was a good choice up until conditional loops and functions were introduced, so I didn't rewrite the whole thing. I did however add a small section on getting the code editor open and why we are switching to it at that point (see line 396 and onwards in python_introduction/README.md)
Closes #207 and #190
🎁