First Blog, Ch 1 & Personal Opinion

--Originally published at S' Nami Bog. Servitas Vitae

This is the first blog which will be based on Chapter 1.
First of I would like to start with the very first page of Chapter 1. It is so short but so true that it hurts, let me explain why. In my opinion today’s standards are beyond our imagination and being honest we see and interact with products, items and people that we think they are perfect. Therefore, we think that anything that we do in our lives has to perfect. Just like the book says and I quote “Where to start?”. We worry too much about what other people could say that we never focus on what is really important, are we enjoying what we’re doing?
The next thing that comes up to my mind is the exercise of what we would change to a software app in this case Rick’s guitar shop (for example) and what do we think makes a great software so here is my opinion regarding this…
“Every time we try to write a program we never take into consideration what the client wants. I truly believe that good apps require less clicks or less taps. Take for instance an app in which you want to buy something, after searching you finally made a conclusion, you added the item to the shopping cart and all of a sudden you get bombarded by multiple ads from the app or web page that has nothing to do with what you want. Things like this makes the customer annoyed and most likely will never use the app again. But what happens when we ignore all of those ads and we try to pay? “TAP HERE TO PAY IMMEDIATELY !” And of course it only requires one tap or click. Another good practice would be having a Continue reading "First Blog, Ch 1 & Personal Opinion"

_CourseReview

--Originally published at Not a Programming Blog

Flipped Classroom

The course was different to any course that I have had before, it consisted in having all the material available and a professor there to guide you. The time inside the classroom was merely dedicated to actively programming and asking questions about programming issues to your classmates or the teacher.

 

My experience

I really liked the methodology of the course. I believe every person is a different world with different perspectives and they learn in different ways as well, this method allows you to learn at your own pace giving you the responsability on what you want to learn and most important giving you the possibility to schedule yourself in order to achieve all your goals.

Having the posibility of learning on your own was incredible, because some of us learn in a way and solve the program with some functions but others research different stuff and solved the same problem in a different way.

This methodology was helpful for me and I really liked to go at my own pace, it made me more responsible and I really liked to help my classmates with what I learnt. This methodology is helpful for some of us, but we have to be honest that is difficult when you’re used to be told what to do, but even though I think is important to keep this methodology because it takes you out of your comfort zone and improve some soft skills that in a normal course you wouldn’t be able to.

 

 

 


Final del curso python

--Originally published at Python student

Bien, con esto ya hemos terminado un curso, en el cual pude aprender demasiada  cosas acerca de la programación, como es hacer una simple suma o escribir un "Hola mundo" hasta leer archivos txt, esto es solo el comienzo hacia una vida llena de programas, ya que seguiremos viendo otros lenguajes de programación, seguire publicando en este blog las cosas que poco a poco vaya aprendiendo. :) hasta dentro de unos mese. 

My own library??

--Originally published at Home Page

As you can see, in python we use the libraries that comes with the python3 package, but, if you want to create a function to use in different programs (For example, in the 46 exercises sometimes we should use functions created in a previous program). you just need to create a program and the define the functions you want to use, is not necessary to write a main function, so just defining the functions we think will be useful, is ok.

There you have an example, these are 2 functions that we will use later.

functionsaa


46 Python exercises: 31-35!

--Originally published at Home Page

31. Implement the higher order functions map(), filter() and reduce(). (They are built-in but writing them yourself may be a good exercise.)

EJ31

32. Write a version of a palindrome recogniser that accepts a file name from the user, reads each line, and prints the line to the screen if it is a palindrome.

EJ32

 

33. According to Wikipedia, a semordnilap is a word or phrase that spells a differentword or phrase backwards. (“Semordnilap” is itself “palindromes” spelled backwards.) Write a semordnilap recogniser that accepts a file name (pointing to a list of words) from the user and finds and prints all pairs of words that are semordnilaps to the screen. For example, if “stressed” and “desserts” is part of the word list, the the output should include the pair “stressed desserts”. Note, by the way, that each pair by itself forms a palindrome!

EJ33

 
34. Write a procedure char_freq_table() that, when run in a terminal, accepts a file name from the user, builds a frequency listing of the characters contained in the file, and prints a sorted and nicely formatted character frequency table to the screen.

EJ34

 

35. The International Civil Aviation Organization (ICAO) alphabet assigns code words to the letters of the English alphabet acrophonically (Alfa for A, Bravo for B, etc.) so that critical combinations of letters (and numbers) can be pronounced and understood by those who transmit and receive voice messages by radio or telephone regardless of their native language, especially when the safety of navigation or persons is essential. Here is a Python dictionary covering one version of the ICAO alphabet:

d = {'a':'alfa', 'b':'bravo', 'c':'charlie', 'd':'delta', 'e':'echo', 'f':'foxtrot',
     'g':'golf', 'h':'hotel', 'i':'india', 'j':'juliett', 'k':'kilo', 'l':'lima',
     'm':'mike', 'n':'november', 'o':'oscar', 'p':'papa', 'q':'quebec', 'r':'romeo',
     's':'sierra', 't':'tango', 'u':'uniform', 'v':'victor', 'w':'whiskey', 
     'x':'x-ray', 'y':'yankee', 'z':'zulu'}

Your task in this

EJ35
Continue reading "46 Python exercises: 31-35!"

46 python Exercises! 26-30!!

--Originally published at Home Page

26. Using the higher order function reduce(), write a function max_in_list() that takes a list of numbers and returns the largest one. Then ask yourself: why define and call a new function, when I can just as well call the reduce() function directly?

 

EJ26

27. Write a program that maps a list of words into a list of integers representing the lengths of the correponding words. Write it in three different ways: 1) using a for-loop, 2) using the higher order function map(), and 3) using list comprehensions.

 

EJ27

28. Write a function find_longest_word() that takes a list of words and returns the length of the longest one. Use only higher order functions.

 

EJ28

29. Using the higher order function filter(), define a function filter_long_words() that takes a list of words and an integer n and returns the list of words that are longer than n.EJ29

 

 

30. Represent a small bilingual lexicon as a Python dictionary in the following fashion {“merry”:”god”, “christmas”:”jul”, “and”:”och”, “happy”:gott”, “new”:”nytt”, “year”:”år”} and use it to translate your Christmas cards from English into Swedish. Use the higher order function map() to write a function translate() that takes a list of English words and returns a list of Swedish words.EJ30


Lambda functions!

--Originally published at Home Page

In python3 we use the lambda operator, you can use it and is like declaring a function in only one line! But, here’s the question. Why we use the lambda operator? Is simple, there are many functions in python3 that we can use with this operator, to work with lists!

We declare the function like this:

lambda x,y:  x if x<y else y

this, will declare a function that takes those 2 parameters (x and y), and returns x if x is minor than y, and if it’s not, return y.

Soon, we are going to use this operator for more interesting programs. If it’s not clear yet, you can use this page where i learned it!

 

http://www.python-course.eu/python3_lambda.php

 

Or check this video:


46 exercises!!! 21-25!

--Originally published at Home Page

21. Write a function char_freq() that takes a string and builds a frequency listing of the characters contained in it. Represent the frequency listing as a Python dictionary. Try it with something like char_freq(“abbabcbdbabdbdbabababcbcbab”).

EJ21

Note: The use of the last two lines i took because a friend recommended me to, you should check his blog, he has interesting stuff!

https://elusblog.wordpress.com/

22. In cryptography, a Caesar cipher is a very simple encryption techniques in which each letter in the plain text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar, who used it to communicate with his generals. ROT-13 (“rotate by 13 places”) is a widely used example of a Caesar cipher where the shift is 13. In Python, the key for ROT-13 may be represented by means of the following dictionary:

key = {‘a’:’n’, ‘b’:’o’, ‘c’:’p’, ‘d’:’q’, ‘e’:’r’, ‘f’:’s’, ‘g’:’t’, ‘h’:’u’,
‘i’:’v’, ‘j’:’w’, ‘k’:’x’, ‘l’:’y’, ‘m’:’z’, ‘n’:’a’, ‘o’:’b’, ‘p’:’c’,
‘q’:’d’, ‘r’:’e’, ‘s’:’f’, ‘t’:’g’, ‘u’:’h’, ‘v’:’i’, ‘w’:’j’, ‘x’:’k’,
‘y’:’l’, ‘z’:’m’, ‘A’:’N’, ‘B’:’O’, ‘C’:’P’, ‘D’:’Q’, ‘E’:’R’, ‘F’:’S’,
‘G’:’T’, ‘H’:’U’, ‘I’:’V’, ‘J’:’W’, ‘K’:’X’, ‘L’:’Y’, ‘M’:’Z’, ‘N’:’A’,
‘O’:’B’, ‘P’:’C’, ‘Q’:’D’, ‘R’:’E’, ‘S’:’F’, ‘T’:’G’, ‘U’:’H’, ‘V’:’I’,
‘W’:’J’, ‘X’:’K’, ‘Y’:’L’, ‘Z’:’M’}
Your task in this exercise is to implement an encoder/decoder of ROT-13. Once you’re done, you will be able to read the following secret message:

Pnrfne pvcure? V zhpu cersre Pnrfne fnynq!
Note that since English has 26 characters, your ROT-13 program will be able to both encode and decode texts written in English.

EJ22

23. Define a simple “spelling correction” function correct() that takes a string and sees to it that 1) two or more occurrences of the space character is compressed

EJ23
EJ24
EJ25
Continue reading "46 exercises!!! 21-25!"

Using Dictionaries in python3!

--Originally published at Home Page

Let’s explain an useful tool we are going to use in the future, the dictionaries.

In python 3 we can use a dictionary as a way to manipulate information, we define it in this form, for example:

Name={“red”:”rojo”,”blue”:”azul”,”yellow”:”amarillo”}

The way we use this information is in keys (the first word of each element) and values(the second word).

You can see this video if you didn’t understand! (I know, sometimes i don’t know how to explain this stuff):