Difference between revisions of "Learn Python the Hard Way 03"
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
− | * Στις προηγούμενες συναντήσεις έχουμε καλύψει τις ασκήσεις 0 εως και | + | * Στις προηγούμενες συναντήσεις έχουμε καλύψει τις ασκήσεις 0 εως και 10 |
Line 43: | Line 43: | ||
− | * We have previously covered exercises 0 to | + | * We have previously covered exercises 0 to 10 (including 10) |
Line 63: | Line 63: | ||
|location=38.01694322164, 23.731269990513 | |location=38.01694322164, 23.731269990513 | ||
}} | }} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Exercise 11 | ||
+ | <pre> | ||
+ | |||
+ | print "How old are you ?", | ||
+ | age = raw_input() | ||
+ | print "How tall are you ?", | ||
+ | height = raw_input() | ||
+ | print "How much do you weigh?", | ||
+ | weight = raw_input() | ||
+ | # weight = int ( raw_input() ) | ||
+ | # weight_number = int ( weight ) | ||
+ | |||
+ | print "So, you 're %r old, %r tall and %r heavy." % ( age, height, weight ) | ||
+ | print "So, you 're %s old, %s tall and %s heavy." % ( age, height, weight ) | ||
+ | |||
+ | # print "So, you 're %f old, %f tall and %f heavy." % ( float(age), float(height), float(weight) ) | ||
+ | # print "So, you 're %d old, %d tall and %d heavy." % ( int(age), int(height), int(weight) ) | ||
+ | |||
+ | print "How old are you ?", | ||
+ | age = input() | ||
+ | print "How tall are you ?", | ||
+ | height = input() | ||
+ | print "How much do you weigh?", | ||
+ | weight = input() | ||
+ | # weight = int ( raw_input() ) | ||
+ | # weight_number = int ( weight ) | ||
+ | |||
+ | print "So, you 're %r old, %r tall and %r heavy." % ( age , height, weight ) | ||
+ | |||
+ | print "So, you 're %s old, %s tall and %s heavy." % ( age, height, weight ) | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | Exercise 12 | ||
+ | |||
+ | <pre> | ||
+ | a = raw_input ("How old r u ? ") | ||
+ | h = raw_input ("How tall r u ? ") | ||
+ | w = raw_input ("How much do u weight? ") | ||
+ | |||
+ | print "So, u r %r old, %r tall & %r heavy." % ( a , h, w ) | ||
+ | |||
+ | |||
+ | python2 -m pydoc raw_input | ||
+ | |||
+ | |||
+ | </pre> | ||
+ | |||
+ | Exercise 13 | ||
+ | |||
+ | <pre> | ||
+ | #!/usr/bin/env python2 | ||
+ | |||
+ | # import sys | ||
+ | |||
+ | # sys.argv | ||
+ | from sys import argv | ||
+ | |||
+ | # variables/arguments are initialized from argv | ||
+ | script, first, second, third = argv | ||
+ | |||
+ | # print script argument | ||
+ | print "The script is called:" , script | ||
+ | # print first argument | ||
+ | print "Your first variable is: " , first | ||
+ | # print second argument | ||
+ | print "Your second variable is: ", second | ||
+ | # print third argument | ||
+ | print "You third variable is: ", third | ||
+ | |||
+ | print "Number of arguments is: ", len( argv ) | ||
+ | print | ||
+ | |||
+ | # print script argument | ||
+ | print "The script is called:" , argv[0] | ||
+ | name = raw_input ("Your name hesse ? ") | ||
+ | # print first argument | ||
+ | print "Your first variable is: " , argv[1] | ||
+ | # print second argument | ||
+ | print "Your second variable is: ", argv[2] | ||
+ | # print third argument | ||
+ | print "You third variable is: ", argv[3] | ||
+ | # print your name | ||
+ | print "Thank you: %r , %r %r %r " % ( name , argv[2] , argv [3] , argv [1 ] ) | ||
+ | |||
+ | </pre> |
Latest revision as of 12:55, 27 June 2015
external link |
Starts | Organizer |
---|---|---|
Mon 15 Jun 2015 18:00 | ||
Ends | Event Owner | |
Mon 15 Jun 2015 20:00 | User:Ebal |
- Κάθε Δευτέρα, 18:00-20:00
- Συναντήσεις για εκμάθηση προγραμματισμού σε python.
Θα είναι υπό την μορφή study group, δηλαδή όλοι θα μαθαίνουμε παρέα και δεν θα υπάρχει κάποιος "δάσκαλος". Οι συναντήσεις είναι ανοιχτές σε όλες και όλους - αρκεί να φέρεις το laptop σου! Απευθύνονται σε ανθρώπους που θέλουν να ξεκινήσουν με python κι άρα θα είναι αρκετά εισαγωγικές. Η μοναδική δέσμευση είναι να τηρηθεί αυστηρά το ωράριο (δηλαδή εάν κάποιος ή κάποια αργήσει, να μην μας ζητήσει να γυρίσουμε πίσω για να καλύψουμε κάτι που έχουμε ήδη πει).
- Θα ακολουθήσουμε την παρακάτω ύλη: http://learnpythonthehardway.org/book/
Έλα εγκαίρως/νωρίς αν θες να βρεις ελεύθερη θέση :)
- Στις προηγούμενες συναντήσεις έχουμε καλύψει τις ασκήσεις 0 εως και 10
Η σελίδα της προηγούμενης συνάντησης (#02) με μερικές σημειώσεις:
https://www.hackerspace.gr/wiki/Learn_Python_the_Hard_Way_02
- Every Monday at 18.00-20:00
- python enthusiasts will try to learn programming "the hard way" !
The meetings will be in study group format, meaning that we will all learn together and there won't be a tutor. Meetings are open to everyone - just bring your laptop! They are for people that want to start learning python, so we will cover some introductory material. The only requirement is to be punctual (so if a person comes later than 18:00 please don't ask us to cover material that we have already gone through).
- Learning resource: http://learnpythonthehardway.org/book/
Come early if you want to ensure that you'll find a space to place your laptop :)
- We have previously covered exercises 0 to 10 (including 10)
The page for the previous meeting (02) with some notes:
https://www.hackerspace.gr/wiki/Learn_Python_the_Hard_Way_02
This is Lesson 03 (intro session)
These events are based on peer2peer education
Exercise 11
print "How old are you ?", age = raw_input() print "How tall are you ?", height = raw_input() print "How much do you weigh?", weight = raw_input() # weight = int ( raw_input() ) # weight_number = int ( weight ) print "So, you 're %r old, %r tall and %r heavy." % ( age, height, weight ) print "So, you 're %s old, %s tall and %s heavy." % ( age, height, weight ) # print "So, you 're %f old, %f tall and %f heavy." % ( float(age), float(height), float(weight) ) # print "So, you 're %d old, %d tall and %d heavy." % ( int(age), int(height), int(weight) ) print "How old are you ?", age = input() print "How tall are you ?", height = input() print "How much do you weigh?", weight = input() # weight = int ( raw_input() ) # weight_number = int ( weight ) print "So, you 're %r old, %r tall and %r heavy." % ( age , height, weight ) print "So, you 're %s old, %s tall and %s heavy." % ( age, height, weight )
Exercise 12
a = raw_input ("How old r u ? ") h = raw_input ("How tall r u ? ") w = raw_input ("How much do u weight? ") print "So, u r %r old, %r tall & %r heavy." % ( a , h, w ) python2 -m pydoc raw_input
Exercise 13
#!/usr/bin/env python2 # import sys # sys.argv from sys import argv # variables/arguments are initialized from argv script, first, second, third = argv # print script argument print "The script is called:" , script # print first argument print "Your first variable is: " , first # print second argument print "Your second variable is: ", second # print third argument print "You third variable is: ", third print "Number of arguments is: ", len( argv ) print # print script argument print "The script is called:" , argv[0] name = raw_input ("Your name hesse ? ") # print first argument print "Your first variable is: " , argv[1] # print second argument print "Your second variable is: ", argv[2] # print third argument print "You third variable is: ", argv[3] # print your name print "Thank you: %r , %r %r %r " % ( name , argv[2] , argv [3] , argv [1 ] )