Skip to content

Commit 1760f00

Browse files
author
Tania Allard
authored
Merge branch 'master' into master
2 parents bbd4c60 + 97189a1 commit 1760f00

File tree

9 files changed

+167
-10
lines changed

9 files changed

+167
-10
lines changed

Hacktoberfest.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Let's get CodeFirst in Hacktoberfest... and practice what you have learned this week!
2+
3+
1. Go to [https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) :jack_o_lantern:
4+
and Sign up using your GitHub account
5+
2. Make sure that your local repository is up to date (Pull your repo! see the GIF below)
6+
![pull](./assets/pull.gif)
7+
3. Also make sure that you are in Master (on GitKraken next to the repository name you should
8+
see 'master')
9+
4. Complete the following tasks
10+
11+
## Task 1
12+
1. Open the `team.md` file contained in the Hacktoberfest folder
13+
![hack](./assets/hack.PNG). Use atom or sublime to open and modify the file.
14+
2. Copy the lines in the document and paste them below the dashes (---) replace this with your own personal information and save the document
15+
3. Stage your files, write a commit message and push to your GitHub account
16+
![commit](./assets/com.gif)
17+
4. Create a pull request from your repository to the main `trallard/Shef_CodeFirst_Python` one
18+
(remember what we checked in class choose on the right side your repo an on the left one trallard/....)
19+
20+
21+
## Task 2
22+
Fun with functions!
23+
1. Create a new script in the Hacktoberfest folder and name it with your own username (e.g for me it would be `trallard.py`)
24+
2. Remember what we learned about use inputs, variables and printing? In your new script create a code for a very basic Starbucks bot 😜 (check exercise 12 from the book for inspiration). Make sure the bot does the following things:
25+
1. Ask for the user name
26+
2. Ask for the order
27+
3. Ask if you want whole milk or almond milk
28+
4. Print a statement confirming the order and giving a price for this!
29+
3. Make sure it runs, save it, commit your changes in Gitkraken and push to your GitHub account.
30+
4. Create a pull request for this task too!
31+
32+
33+
## Task 3!!! You are almost done! :fire:
34+
1. Complete Exercise 21 in the Learn the Python the hard way. Save your script as `<username>21.py` (e.g. trallard21.py) in the Hacktoberfest folder.
35+
2. Once completed commit your changes, and push to your repository!
36+
3. Make your final pull request to the repository.
37+
38+
Remember you have up to 11:59pm October 31st to complete this. If you need any help let us know on Facebook, slack or via email!

Hacktoberfest/team.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Copy the following lines and replace them with your own personal information
2+
(do not forget to copy the --- too)
3+
4+
Name: Tania A.
5+
Did you do the CSS beginners course? Yes / No
6+
Add your twitter username here: @ixek
7+
What sort of website would you like to build?
8+
9+
---

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
* [Session 3](session-3.md)
1111
* [Session 4](session-4.md)
1212
* [Appendix: terminal mini tutorial](terminal.md)
13+
* [Hacktoberfest](Hacktoberfest.md)
1314

assets/com.gif

377 KB
Loading

assets/hack.PNG

4.6 KB
Loading

assets/pull.gif

183 KB
Loading

session-2.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#### Getting input from a user
2424

25-
From last week's session we now know how to create variables and how to print them, but what if we don't know what the value of our variable should be, because we need to get it from a user? Using the method `raw_input()` we can prompt a user for information.
25+
From last week's session we now know how to create variables and how to print them, but what if we don't know what the value of our variable should be, because we need to get it from a user? Using the method `input()` we can prompt a user for information.
2626

2727

2828
---
@@ -33,7 +33,7 @@ From last week's session we now know how to create variables and how to print th
3333

3434
```python
3535
print("What's your name?")
36-
name = raw_input()
36+
name = input()
3737
print("Hello {}!".format(name))
3838
```
3939

@@ -60,16 +60,19 @@ def hello_world():
6060

6161
Any time you write a function in Python, it'll have the following things:
6262

63-
- def at the very beginning, so that Python knows the indented code below is part of a function (you're "defining" your function below this line).
64-
- A unique name, with no spaces in it. It's important that you don't have two functions with the exact same name in your code. You also don't want to name your function "function", "sum" or "python" (or later on in this course "email", "mailgun", or "tweepy"). If you name your function after a Python library or package or built-in function, Python will get really confused and your code won't run.
63+
- **def** at the very beginning, so that Python knows the indented code below is part of a function (you're "defining" your function below this line).
64+
- **A unique name**, with no spaces in it. It's important that you don't have two functions with the exact same name in your code. You also don't want to name your function "function", "sum" or "python" (or later on in this course "email", "mailgun", or "tweepy"). If you name your function after a Python library or package or built-in function, Python will get really confused and your code won't run.
6565

6666
- You'll also need to put brackets and a colon right after the name.
6767

6868
Notice how, after the first line of code in a function, the other lines are indented. In Python, this is very important – it's how the code interpreter in your computer knows what's part of your function and what isn't.
6969

7070
#### Calling a function
7171

72-
A function by itself doesn't actually do anything. You have to "call" it by its name, to run the code inside it. Calling a function is really easy! All you have to do is type the name of your function with () after it, like this: hello_world()
72+
A function by itself doesn't actually do anything. You have to "call" it by its name, to run the code inside it. Calling a function is really easy! All you have to do is type the name of your function with () after it, like this:
73+
```python
74+
hello_world()
75+
```
7376

7477
Notice that the function call is NOT indented, because it's not part of the function definition!
7578

@@ -144,7 +147,7 @@ You must use variable names for your arguments when you're defining your functio
144147

145148
You can use functions to do stuff like crunch numbers or manipulate data, and then "return" information from your function so that you can use it somewhere else in your program.
146149

147-
Functions can return a number, a string, a list, or even another function (we'll learn about one called render_template() later on in this course). Today, we're going to learn how to return a simple number value from your function.
150+
Functions can return a number, a string, a list, or even another function (we'll learn about one called `render_template()` later on in this course). Today, we're going to learn how to return a simple number value from your function.
148151

149152
Let's have a look at the code below:
150153
```python
@@ -169,7 +172,7 @@ If you're returning something, the return statement should be the last line you
169172
---
170173
#### Task
171174

172-
1. What do you think returned_value will be if you don't have a return line in your function? Copy the code from the example above into your **my_arguments.py** file and run the file. Then remove only the line return answer and see what happens.
175+
1. What do you think `returned_value `will be if you don't have a return line in your function? Copy the code from the example above into your **my_arguments.py** file and run the file. Then remove only the line return answer and see what happens.
173176

174177
----
175178

@@ -277,7 +280,7 @@ Copy and paste the code below into a new file called **numbers.py** and run the
277280

278281
```python
279282

280-
number =raw_input("Enter a number between 1 and 10: ")
283+
number =input("Enter a number between 1 and 10: ")
281284
number =int(number) #Converts the input string to an integer
282285

283286
if number > 10:
@@ -294,7 +297,7 @@ if number <=0:
294297

295298
If none of your conditions are met, Python will simply carry on through the rest of your code. In the example above, we didn't write any code for the situation where the user enters a number between 1 and 10, so you didn't see any sort of helpful message or feedback in your terminal.
296299

297-
Notice how we used `int() `to convert the user input into a number. raw_input() treats all input as a string, so we used information in [Python's documentation](https://docs.python.org/2.7/library/stdtypes.html#typesnumeric) to figure out how to convert the user input to a number. You don't need to worry about this right now, but it's an example of something useful you can do with Python.
300+
Notice how we used `int() `to convert the user input into a number. input() treats all input as a string, so we used information in [Python's documentation](https://docs.python.org/2.7/library/stdtypes.html#typesnumeric) to figure out how to convert the user input to a number. You don't need to worry about this right now, but it's an example of something useful you can do with Python.
298301

299302
---
300303

session1/collaborative.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Hi there welcome to the collaborative exercise!
22
# Start typing your answers below
3+
34
my_name 'Gabriella'
45
favourite_food 'chocolate'
5-
print favourite_food + my_name
6+
print (favourite_food + my_name)
7+
8+
name2 = 'Hope'
9+
favourite_food2 = 'pizza'
10+
description2 = 'My name is {} and my favourite food is {}.'. format (name, favourite_food)
11+
12+
name = "Isabella"
13+
favourite_food = "pizza"
14+
description= "my name is {} and my favourite food is {}".format(name, favourite_food)
15+
print(description)

session1/ex.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
formatter = "%r %r %r %r"
2+
3+
print (formatter % (1, 2, 3, 4))
4+
print (formatter % ("one", "two", "three", "four"))
5+
print (formatter % (formatter, formatter, formatter, formatter))
6+
print (formatter % (
7+
"I had this thing.",
8+
"That you could type up right.",
9+
"but it didn't sing.",
10+
"so I said goodnight"
11+
))
12+
13+
14+
15+
#x = "there are %d types of people." %10
16+
#binary = "binary"
17+
#do_not = "don't"
18+
#y = "those who know %s and those who %s." % (binary, do_not)
19+
20+
#print (x)
21+
#print (y)
22+
23+
#print ("I said: %r." % x)
24+
#print ("I also said: '%s'." % y)
25+
26+
#hilarious = False
27+
#joke_evaluation = "isn't that joke so funny?! %r"
28+
29+
#print (joke_evaluation % hilarious)
30+
31+
#w = "This is the left side of..."
32+
#e = "a string with a right side"
33+
34+
#print (w + e)
35+
36+
#my_name = "Isabella Talbot"
37+
#my_age = 21
38+
#my_height = 160
39+
#my_weight = 45
40+
#my_eyes = "green"
41+
#my_teeth = "white-ish"
42+
#my_hair = "blonde"
43+
44+
#print("lets talk about %s." % my_name)
45+
#print("she's %d cm tall" % my_height)
46+
#print("she's %d kg heavy" % my_weight)
47+
#print("actually that's not too heavy")
48+
#print("she's got %s eyes and %s hair" % (my_eyes, my_hair))
49+
#print("her teeth are usually %s depending on the tea" % my_teeth)
50+
51+
#print("if I add %d, %d, and %d I get %d." % (my_age, my_height, my_weight, my_age + my_height + my_weight))
52+
53+
54+
#cars = 100
55+
#space_in_a_car = 4.0
56+
#drivers = 30
57+
#passengers = 90
58+
#cars_not_driven = cars - drivers
59+
#cars_driven = drivers
60+
#carpool_capacity = cars_driven * space_in_a_car
61+
#average_passengers_per_car = passengers / cars_driven
62+
63+
#print("there are", cars, "cars available")
64+
#print("there are only", drivers, "drivers available")
65+
#print("there will be", cars_not_driven, "empty cars today")
66+
#print("we can transport", carpool_capacity, "people today")
67+
#print("we have", passengers, "to carpool today")
68+
#print("we need to put about", average_passengers_per_car, "in each car")
69+
70+
71+
#print ("hello world!")
72+
#print ("hello again")
73+
#print ("I like typing this.")
74+
#print ("this is fun.")
75+
#print ("yay! printing.")
76+
#print ("I'd much rather you 'not'.")
77+
#print ('I "said" do not touch this.')
78+
79+
#print ("I will now count my chickens:")
80+
#print ("hens", 25 + 30 / 6)
81+
#print ("Roosters", 100 - 25 * 3 % 4)
82+
83+
#print ("Now I will count the eggs:")
84+
#print (3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)
85+
86+
#print ("is it true that 3 + 2 < 5 - 7?")
87+
#print (3 + 2 < 5 - 7)
88+
89+
#print ("what is 3 + 2?", 3 + 2)
90+
#print ("what is 5 - 7?", 5 - 7)
91+
#print ("oh that's why it's false")
92+
93+
#print("how about some more.")
94+
#print("Is it greater?", 5> -2)
95+
#print("is it greater or equal?", 5>= -2)
96+
#print("is it less or equal?", 5 <= -2)

0 commit comments

Comments
 (0)