in python 3 there is a project called block letters where we have to make enlarged block letters out of our initials. i was wondering if there was a module that has all the enlarged block letters of alphabet or a method where i can use some code to output enlarged versions of the alphabet.
This topic came up a couple weeks ago. Check this thread…
i checked it out and it pretty much had everything i needed. i just have one more question, how would i use this code for printing out words instead of intials. I tried using args to make it accept words but it doesn’t work.
for i in range(7):
print (alpha[a.upper()][i*7:i*7+7], alpha[b.upper()][i*7:i*7+7])
print_word(‘a’, ‘b’, ‘c’)
this part doesn’t seem to be working.
Not sure you’re getting the right message. It wasn’t to copy our code, but to learn from its constructs and logic, then extend that to a new level. Apply yourself enough to conceive at this level of code on your own. Don’t use borrowed code, ever. Ideas, that’s okay. Code? Never. Be the one to conceive what you present to the world.
What we need is interlacing, to be able to read the first 7 bytes of every character in the phrase/sentence and print their concatenation, followed by the next 7 bytes of every character, and so on. This is challenging stuff. It is doable if you have the tenacity and ingenuity. Research the interlacing topic.
Our interlacing tool would be taking an object, the character map, and a row number 0 to 6 inclusive. The return would be the row in the character map. The function would be called as many times as there are characters in the line.
One must confess that we may be off on the terminology since interlacing actually involves two lines, but I kind of wanted to mean the same algorithm.
You’re right. In a hurry to find a answer to my question i stopped trying to understand and just looked for the easy way out. I’m never going to make this mistake again. Also i don’t know about interlacing . i just started coding a month ago so i don’t really know where to learn about interlacing I tried to find it in the python documentation but couldn’t find it. Could u suggest a place from where I could learn interlacing.
Is there any standardized place for learning interlacing etc like the python documentation.
Okay, sorry, this is all way out in left field. First, have you printed a letter to the screen using the given specifications? It will take seven print statements.
yes I did that. I also thought that if I make a similar representation for every letter then I could print any word I wanted. What I was wondering was if it was possible to print my letters side by side instead of vertically.
Anything is possible. It will take the kind of logic mentioned above.
Okay, after playing with the earlier code I was able to come up with a function to print a phrase. Length will be determined by viewport width which this does not take into account, being very preliminary.
Thank you so much . To be honest though i don’t quite understand the code. the part related to 15 digit numbers so i will try to do some research on that.
If you go back to that other thread, it is revealed how I arrived at those numbers. Some are 16 digit. They are the integer conversion of the binary string that we start out with (50 bits, the first one always 1, and starting with
0b). Essentially we have taken the 49 characters from the map and given them a 1 or a zero, then constructed a binary string from that. We then convert that to an integer, which you see in the list as 15/16 digit numbers. Our code converts that back to binary and uses the rightmost 49 bits to reform our string of spaces and letters. The letter we insert is the one given from the input.
Don’t know if I published the code, or not. Will have to dig around to see if I still have it. Once that list was created, it became rather moot.
If you ever use this code in anything, even a post, be sure to cite this thread or the repl. Don’t be posting it willy nilly. It’s not your code. My repls are public, as is everything I post here. Search engines can and more than likely have found it already. Never use borrowed code that, a) you don’t fully understand, and, b) you couldn’t write yourself. In any event, always cite the source. That will keep you out of the woods and the dog house.
Also, if you study the code closely, it uses the interlacing technique we spoke of earlier. That is the beauty of this algorithm.
Sure if at all anyone i know wants to know about this topic i’ll make sure to send them the link to this post instead of giving them the code.
I will look at the other thread and make sure to connect all the dots so that i can grasp the idea and understand how the code works.
Thank you for all your effort in helping me
It’s been a ride. Loved every minute of it. Happy coding!
If you ever have a need to use this code, it is not forbidden as long as the proviso is upheld. Do exploit it, and keep us apprised of your innovations. There is still the viewport width issue to contend with, which means wraparound (or some form of overflow detection/mitigation, even if it means cutting the phrase short). This problem is not solved, not by a long shot. Have at it…