While doing WSQ12 ‘Word Count’, I found a way edit a text file and save what the user wants to write. The only problem about it is that this code is in basic phase, and it will overwrite the text file. This means that if you run it twice, the first text that was written in the first run will be deleted in order to write what was given in the second run. Anyways, here is how to do it. You can look it at my GitHub with comments.
text = str(input("Submit what you want to write: "))
file = open(“Test2.txt”,”w”)
An empty file was used for testing and this is what happened after the first run of the code.
Let’s relax now from this short post. Here is a relaxing song for you: “Run Off The Road” by Ola Podrida. Hope you enjoy the calm of the acoustic guitar and the perfect harmony of the lyrics.
I got bored during Vertical Workshop a couple of weeks ago, so I searched of how to do a chronometer. This was succesfully done by the use of import time. Then by using the content within it. There was a glitch were the counter in the first two seconds were almost similar, causing the counter to be delayed for 1 second, so I used +1 in the elapsed time to avoid this glitch. This step made the total of seconds to be increased by one total second. For example, if the user wants to print 10 seconds, the program will return 11 seconds. There is still a problem: every ten seconds the counter delays a maximum of 0.6 seconds. I noticed these by comparing it with my cellphone’s chronometer. Anyways, this is how it looks.
This bonus code is also included in my GitHub, so you can get a closer look at it.
Let me introduce you a song from one of my favorite bands. The band is Radiohead and the song is “Nice Dream”, a song released in 1995 as part of the album ‘The Bends’. What I love about this band is that most of their songs have an acoustic guitar and a calmly tune, this two facts is what I love the most in a song.