-
Start up the Python Interactive Interpreter.
- Print out "Hello New York"
- Store your name in a variable
- Print the contents of this variable.
- Copy and paste your interactive session into P1_1.txt in your problem set repository
-
Working with a text editor. Use vi to write a script call P1_2.py in your problem set repository
-
Make sure to include
#!/usr/bin/env python3
at the top!! -
Add code to print out, your name
My name: Sofia
-
On the command line make it executable using
chmod
(only have to do this one time per script). -
Run it from the command line.
-
Remember it is important to write only a bit, test, then write more.
-
If it works, ADD/COMMIT. Make a good message, like "added name to print"
-
Now add some code to print out your favorite color:
My name: Sofia My favorite color: Green
-
Save it, and run it from the command line.
-
Now add some code to create a variable with your favorite activity. Make sure to give your variable a descriptive name.
-
Print out the variable with your favorite activity. You will need to use a comma in your print statement to print text and your variable.
print("some text" , your_variable)
My name: Sofia My favorite color: Green My favorite activity: Coding
-
Save it, and run it from the command line.
-
Now add some code to print out your favorite animal:
My name: Sofia My favorite color: Green My favorite activity: Coding My favorite animal: Chicken
!!! Remember, write a bit, then run your code, write some more, then run again. This makes code easier to debug.
-
-
Now create a new script called P1_3.py. In this script use
sys.argv
(make sure to import sys!!!) to retrieve your name, favorite color, favorite activity, and favorite animal from the command line. Remember to check out the example in the notes. Print all the variables in one print statement.- try using commas to separate your print arguments.
- try using '+' to separate your print arguments.
-
Make sure to keep your remote repository synced with your local repo. (ADD/COMMIT/PUSH). Run the
history
command. Copy and paste the history of your git commands into a file called P1_4.txt in your problem set respository.
-
Notifications
You must be signed in to change notification settings - Fork 0
prog4biol/python-1-problem-set-srobb1
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
python-1-problem-set-srobb1 created by GitHub Classroom
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published