Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
40b355d
Updates SUMMARY.md
Oct 18, 2017
3068b6c
darrenvong Oct 18, 2017
811edfb
Merge pull request #17 from trallard/remove_templates_from_master
Oct 18, 2017
9ad0089
session1 collab
Oct 18, 2017
476b70d
Merge remote-tracking branch 'origin/master'
Oct 18, 2017
aadb1c2
Merge remote-tracking branch 'upstream/master'
JieXinT Oct 18, 2017
2e9ce3b
Merge remote-tracking branch 'upstream/master'
Oct 18, 2017
a99bea8
Merge remote-tracking branch 'upstream/master'
pragy30 Oct 18, 2017
c310f65
Merge remote-tracking branch 'upsteam/master'
isabellatalbot Oct 18, 2017
b24b42a
Merge remote-tracking branch 'upstream/master'
HA1907 Oct 18, 2017
0e18267
Merge remote-tracking branch 'upstream2/master'
LeniRo Oct 18, 2017
ec7335c
Merge branch 'master' into upstream/master
HA1907 Oct 18, 2017
fca4767
Merge remote-tracking branch 'upstream/master'
HA1907 Oct 18, 2017
85ea71d
Minor corrections
Oct 23, 2017
99878cd
Collaborative exercise
isabellatalbot Oct 25, 2017
6f71d0f
Made changes to collaborative.py
pragy30 Oct 25, 2017
d7e6d4b
Collaborative exercise :)
LeniRo Oct 25, 2017
b140bfc
JieXinT Oct 25, 2017
bbd4c60
Oct 25, 2017
c6b55a4
Collaborative ex session1
HA1907 Oct 25, 2017
e81db50
Adding collaborative path
Aveces Oct 25, 2017
b506922
abi-b Oct 25, 2017
d68c81a
abi-b Oct 25, 2017
760c962
Hacktober fest
Oct 26, 2017
96eb9f1
Task 1 Hacktoberfest
Oct 26, 2017
6e73f0b
commit
Oct 26, 2017
96fbd77
ammends
Oct 26, 2017
9f20980
Fixed path
Oct 26, 2017
2790263
Finished tasks
Oct 26, 2017
2e6b69e
Typos and stuff
Oct 26, 2017
41e730d
Title
Oct 26, 2017
1d1a57a
Changes to script names
Oct 26, 2017
dced9e7
Add desc
Oct 26, 2017
f16d7bf
Updates SUMMARY.md
Oct 26, 2017
4914554
Merge f16d7bf460c89f3205fcfb558cad8a9bd9e7b17b into master
Oct 26, 2017
fa4a3b5
Update Hacktoberfest.md
Oct 28, 2017
0aa3169
Task1 Hacktoberfest
pragy30 Oct 28, 2017
bd80d4f
Task 1 - hackotberfest
pragy30 Oct 28, 2017
4814d4c
Task 2 - hacktoberfest
pragy30 Oct 28, 2017
2c8d21f
Task 3 - hacktoberfest
pragy30 Oct 28, 2017
8b414dc
Merge pull request #24 from isabellatalbot/master
Oct 29, 2017
c545172
Merge branch 'master' into master
Oct 29, 2017
b380128
Merge branch 'master' into master
Oct 29, 2017
97189a1
Merge pull request #25 from HA1907/master
Oct 29, 2017
1760f00
Merge branch 'master' into master
Oct 29, 2017
d356593
Merge branch 'master' into master
Oct 29, 2017
ae11485
Merge pull request #26 from gabriellasmith/master
Oct 29, 2017
8d81ced
Merge branch 'master' into master
Oct 29, 2017
db8063d
Merge branch 'master' into master
Oct 29, 2017
a0e33f9
Merge pull request #27 from pragy30/master
Oct 29, 2017
dc2dff4
Merge pull request #28 from JieXinT/master
Oct 29, 2017
33fb83e
Merge branch 'master' into master
Oct 29, 2017
aa5f5f7
Merge branch 'master' into master
Oct 29, 2017
5bccb35
Merge pull request #29 from Aveces/master
Oct 29, 2017
dadf25b
Merge pull request #32 from abi-b/master
Oct 29, 2017
69191fd
Merge pull request #33 from LeniRo/master
Oct 29, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Collaborative/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
print ('Hello, World!')
print('Bob'*3)
print('hello'.upper())
print('GOODBYE'.lower())
print("the lord of the rings".title())

#add variables
age=25
hobby='baking'
description="My age is {} and I like {}".format(age, hobby)
print(description)

"""This is my first
piece of code"""

#variables
name='Jie Xin'
favourite_food='pizza'
description="My name is {} and my favourite food is {}".format(name, favourite_food)
print(description)

38 changes: 38 additions & 0 deletions Hacktoberfest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Let's get CodeFirst in Hacktoberfest... and practice what you have learned this week!

1. Go to [https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) :jack_o_lantern:
and Sign up using your GitHub account
2. Make sure that your local repository is up to date (Pull your repo! see the GIF below)
![pull](./assets/pull.gif)
3. Also make sure that you are in Master (on GitKraken next to the repository name you should
see 'master')
4. Complete the following tasks

## Task 1
1. Open the `team.md` file contained in the Hacktoberfest folder
![hack](./assets/hack.PNG). Use atom or sublime to open and modify the file.
2. Copy the lines in the document and paste them below the dashes (---) replace this with your own personal information and save the document
3. Stage your files, write a commit message and push to your GitHub account
![commit](./assets/com.gif)
4. Create a pull request from your repository to the main `trallard/Shef_CodeFirst_Python` one
(remember what we checked in class choose on the right side your repo an on the left one trallard/....)


## Task 2
Fun with functions!
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`)
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:
1. Ask for the user name
2. Ask for the order
3. Ask if you want whole milk or almond milk
4. Print a statement confirming the order and giving a price for this!
3. Make sure it runs, save it, commit your changes in Gitkraken and push to your GitHub account.
4. Create a pull request for this task too!


## Task 3!!! You are almost done! :fire:
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.
2. Once completed commit your changes, and push to your repository!
3. Make your final pull request to the repository.

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!
9 changes: 9 additions & 0 deletions Hacktoberfest/pragyc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Starbucks bot
name=input("Can I have your name please?")
order=input("Can I have your order please?")
milk=input("Would you like whole milk or almond milk with your order?")

def starbucks_bot(name,order,milk):
print("Your name is {}. You would like {} with {} milk. Thank you, please wait while we get your order prepared".format(name, order, milk))

starbucks_bot(name,order,milk)
26 changes: 26 additions & 0 deletions Hacktoberfest/pragyc21.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def add(a, b):
print 'ADDING %d + %d' % (a, b)
return a + b

def subtract(a, b):
print 'SUBTRACTING %d - %d' % (a, b)
return a - b

def multiply(a, b):
print 'MULTIPLYING %d * %d' % (a, b)
return a * b

def devide(a, b):
print 'DEVIDING %d * %d' % (a, b)
return a / b

age = add(15, 5)
height = subtract(18, 3)
weight = multiply(100, 3)
iq = devide(100, 20)

print 'age: %d, height: %d, weight: %d, iq: %d' % (age, height, weight, iq)

#puzzle for extra credit
what = add(age, subtract(height, multiply(weight, devide(iq, 2))))
print "That becomes: ", what, "Can you do it by hand?"
14 changes: 14 additions & 0 deletions Hacktoberfest/team.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Copy the following lines and replace them with your own personal information
(do not forget to copy the --- too)

Name: Tania A.
Did you do the CSS beginners course? Yes / No
Add your twitter username here: @ixek
What sort of website would you like to build?

---
Name: P. C.
Did you do the CSS beginners course? No
Add your twitter username here: @pragy30
What sort of website would you like to build? data statistics
---
2 changes: 2 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
* [Session 2](session-2.md)
* [Session 3](session-3.md)
* [Session 4](session-4.md)
* [Appendix: terminal mini tutorial](terminal.md)
* [Hacktoberfest](Hacktoberfest.md)

Binary file added assets/com.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/hack.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pull.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions collaborative.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Hi there welcome to the collaborative exercise!
# Start typing your answers below
my_name = 'Gabriella'
favourite_food = 'chocolate'
print "my name is {} and my favourite food is {}.".format(my_name, favourite_food)
4 changes: 4 additions & 0 deletions homework.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name= 'Abi'
favourite_food= 'noodles'
text= 'My name is{} and my favourite food is {}'. format (name, favourite_food)
print (text)
3 changes: 3 additions & 0 deletions homework1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = "Eleni"
food = "pie"
print ("my name is {} and I love {}".format (name, food))
21 changes: 12 additions & 9 deletions session-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#### Getting input from a user

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.
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.


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

```python
print("What's your name?")
name = raw_input()
name = input()
print("Hello {}!".format(name))
```

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

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

- 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).
- 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.
- **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).
- **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.

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

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.

#### Calling a function

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()
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:
```python
hello_world()
```

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

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

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.

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.
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.

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

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.
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.

----

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

```python

number =raw_input("Enter a number between 1 and 10: ")
number =input("Enter a number between 1 and 10: ")
number =int(number) #Converts the input string to an integer

if number > 10:
Expand All @@ -294,7 +297,7 @@ if number <=0:

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.

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.
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.

---

Expand Down
30 changes: 30 additions & 0 deletions session1/collaborative.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Hi there welcome to the collaborative exercise!
# Start typing your answers below

name4 = 'Maureen'
fav_food = 'Thai & Mexican food'

description = "Hello! My name is {} and my favorite food is {}.".format(name4, fav_food)
print(description)


# add name and favourite food
name3 = "Pragya"
food3 = "daal-chawal"

# print
letsprint = "I am {} and I love to eat {}".format(name3 , food3)
print(letsprint)

my_name 'Gabriella'
favourite_food 'chocolate'
print (favourite_food + my_name)

name2 = 'Hope'
favourite_food2 = 'pizza'
description2 = 'My name is {} and my favourite food is {}.'. format (name, favourite_food)

name = "Isabella"
favourite_food = "pizza"
description= "my name is {} and my favourite food is {}".format(name, favourite_food)
print(description)
96 changes: 96 additions & 0 deletions session1/ex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
formatter = "%r %r %r %r"

print (formatter % (1, 2, 3, 4))
print (formatter % ("one", "two", "three", "four"))
print (formatter % (formatter, formatter, formatter, formatter))
print (formatter % (
"I had this thing.",
"That you could type up right.",
"but it didn't sing.",
"so I said goodnight"
))



#x = "there are %d types of people." %10
#binary = "binary"
#do_not = "don't"
#y = "those who know %s and those who %s." % (binary, do_not)

#print (x)
#print (y)

#print ("I said: %r." % x)
#print ("I also said: '%s'." % y)

#hilarious = False
#joke_evaluation = "isn't that joke so funny?! %r"

#print (joke_evaluation % hilarious)

#w = "This is the left side of..."
#e = "a string with a right side"

#print (w + e)

#my_name = "Isabella Talbot"
#my_age = 21
#my_height = 160
#my_weight = 45
#my_eyes = "green"
#my_teeth = "white-ish"
#my_hair = "blonde"

#print("lets talk about %s." % my_name)
#print("she's %d cm tall" % my_height)
#print("she's %d kg heavy" % my_weight)
#print("actually that's not too heavy")
#print("she's got %s eyes and %s hair" % (my_eyes, my_hair))
#print("her teeth are usually %s depending on the tea" % my_teeth)

#print("if I add %d, %d, and %d I get %d." % (my_age, my_height, my_weight, my_age + my_height + my_weight))


#cars = 100
#space_in_a_car = 4.0
#drivers = 30
#passengers = 90
#cars_not_driven = cars - drivers
#cars_driven = drivers
#carpool_capacity = cars_driven * space_in_a_car
#average_passengers_per_car = passengers / cars_driven

#print("there are", cars, "cars available")
#print("there are only", drivers, "drivers available")
#print("there will be", cars_not_driven, "empty cars today")
#print("we can transport", carpool_capacity, "people today")
#print("we have", passengers, "to carpool today")
#print("we need to put about", average_passengers_per_car, "in each car")


#print ("hello world!")
#print ("hello again")
#print ("I like typing this.")
#print ("this is fun.")
#print ("yay! printing.")
#print ("I'd much rather you 'not'.")
#print ('I "said" do not touch this.')

#print ("I will now count my chickens:")
#print ("hens", 25 + 30 / 6)
#print ("Roosters", 100 - 25 * 3 % 4)

#print ("Now I will count the eggs:")
#print (3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)

#print ("is it true that 3 + 2 < 5 - 7?")
#print (3 + 2 < 5 - 7)

#print ("what is 3 + 2?", 3 + 2)
#print ("what is 5 - 7?", 5 - 7)
#print ("oh that's why it's false")

#print("how about some more.")
#print("Is it greater?", 5> -2)
#print("is it greater or equal?", 5>= -2)
#print("is it less or equal?", 5 <= -2)
Binary file removed templates/Code First Girls Python welcome email.docx
Binary file not shown.
Loading