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


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


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.



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!


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.



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

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?



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.



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.



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!




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


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!


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.


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

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:


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):

46 Exercises: 16-20!!

--Originally published at Home Page

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



17. Write a version of a palindrome recognizer that also accepts phrase palindromes such as “Go hang a salami I’m a lasagna hog.”, “Was it a rat I saw?”, “Step on no pets”, “Sit on a potato pan, Otis”, “Lisa Bonet ate no basil”, “Satan, oscillate my metallic sonatas”, “I roamed under it as a tired nude Maori”, “Rise to vote sir”, or the exclamation “Dammit, I’m mad!”. Note that punctuation, capitalization, and spacing are usually ignored.


18.A pangram is a sentence that contains all the letters of the English alphabet at least once, for example: The quick brown fox jumps over the lazy dog. Your task here is to write a function to check a sentence to see if it is a pangram or not.



19. “99 Bottles of Beer” is a traditional song in the United States and Canada. It is popular to sing on long trips, as it has a very repetitive format which is easy to memorize, and can take a long time to sing. The song’s simple lyrics are as follows:

99 bottles of beer on the wall, 99 bottles of beer.
Take one down, pass it around, 98 bottles of beer on the wall.

The same verse is repeated, each time with one fewer bottle. The song is completed when the singer or singers reach zero.

Your task here is write a Python program capable of generating all the verses of the song.EJ19



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

Continue reading "46 Exercises: 16-20!!"