Is it Wether or Weather or Whether?

I had a dyslexic moment and could not remember which weather I wanted. So I looked it up. Following the advice to “blog your homework”. Here’s the answer for next time I forget.

TL;DR: Whether or not the weather is good will decide if we go to see the wether.

Wether

Wether is a castrated goat or ram. It can also be part of a British place name. You probably don’t want this one.

Here’s a Wikipedia link if you want to know more.

Weather

Weather is the stuff that is falling out of the sky. Snow, rain, sunshine, clouds, gale force winds – these are all weather.

Here are some animals being unimpressed with the weather.

Whether

This is the speculative one. You use whether when there is doubt or choice. Whether or not you want to do this depends on what you are writing about.

#blogYourHomework #tips #words #writing

Everything I have learned about good typsetting on websites and blogs

This post is an example of “blog your homework”, the idea that when you research something, you should write about it. I’ve been looking at making blogs and indie personal websites nice and readable.

Why am I writing this?

This all started a few days ago when I realised how hard this blog was to read. I updated my CSS for larger font sizing. According to one source, 20px font sits nicely in the overlap for good readability on desktop and mobile. Thus, I went with size 20px.

Am I qualified to write this?

No, not remotely. That’s why I am writing this as a homework notebook. Expect lots of links and cited sources. After all, you should not take what I say on faith. You should trust but verify. Or distrust and verify. Whichever works for you.

Legibility vs Readability

Alyssa Clarke has 12 Typography Guidelines For Good Website Usability for Usability Geek. One of her points is that there is a distinct difference between legible and readable. My old website design was legible – you could perceive all the words, but, with its long word-to-line ratio, it was not so readable.

With websites, we should aim for readable, not just legible.

Be aware of ideal line lengths

There is an optimal line length. I tend to think of it as “roughly 12 words”, but there is some far more accurate guidance out there.

The ideal line length for readable text is 50–75 characters per line (CPL), with 66 CPL being the sweet spot. This range helps reduce eye strain, improves comprehension, and ensures a smooth reading experience. Lines that are too long or too short disrupt reading flow, making content harder to follow.

Optimal Line Length for Readability, Andrew Martin, uxpin.com

Filippos Protogeridis cites research from the Baymard Institute, The Elements of Typographic Style Applied to the Web, as well as the book Typographie by E. Ruder. for giving 50-75 characters per line on desktops, and 30-50 CPL on mobile. There is a single goodish-for-both value of 50 CPL. Although one might want to do mobile-first responsive design and optimise hard for each screen size.

Yet when text is difficult to read due to the length of the lines, users are much less willing to engage with the text, or struggle to read efficiently.

Readability: The Optimal Line Length, Edward Scott (Research Lead), Baymard Institiute

Do better writing

Marieke van de Rakt, writing for Yoast in “5 tips for writing readable blog posts“, suggests short sentences, clear paragraphs, and more transition words.

I can testify that some blogs and indie sites are easier to read because they were written by someone who has a lot of practice writing. I have a few hacky tips that can make your writing seem easier to read.

  • After three sentences strongly consider a new paragraph
  • Use a few one-sentence paragraphs.
  • Throw in the odd one-word sentence.
  • Any time you write “and” or place a comma, ask yourself if you could replace it with a full stop.
  • Read it out loud before you publish.

Anyone who feels they know what they are doing should ignore these rules. They are nothing more than training wheels.

Use headings based on hierarchy, says Yale University

Yale says, not only should you use headings you should also avoid using bold and mark up as actual headings. This makes it easier for idiots like me to keep place in the post, scan for the bit that interests me, refer back to that one nice bit I want to cite but have to reread the whole thing for because now I can’t find it.

More than that, actual header tags are good SEO and most importantly, good for visitors that need special tools to help them read and enjoy your content.

Better writing tips from Yale include:

  • Write at a high school grade level,
  • Limit paragraphs to around ~80 words if possible
  • Avoid jargon and difficult language where possible

My own advice for engaging idiots like me

Pictures!

No, seriously, images relevant to the article (like diagrams and infographics) help people like me to stay engaged. Sometimes a funny meme that reinforces a point or a decorative image that looks nice with the content can help my easily distracted brain stay on task for reading your lovely and informative words.

Use all the tricks to keep those eyeballs where you want them.

Font choice matters

On the A11y Collective blog, Andrée Lange addresses the problems with poor font choice in “How to Pick the Perfect Font Size: A Guide to WCAG Accessibility”.

Choosing a font size that’s too small or too large can decrease readability, especially for users who may be experiencing conditions such as myopia, hyperopia, or astigmatism. This could make it harder for them to absorb your web content and navigate your site, leading to many unwanted consequences, such as poor user experience, increased bounce rates, bad Search Engine Optimization (SEO) performance, and reduced conversions.

How to Pick the Perfect Font Size: A Guide to WCAG Accessibility, Andrée Lange, A11y Collective

The A11y Collective article has a lot of best practice technical and design details. For those wanting further reading and insights, this might be the one for you.

Jordan DeVos explains in “Designing for Readability: A Guide to Web Typography (With Infographic)” the importance of typography (font selection) on the web. Here’s the infographic (might not work on federated copies).

Infographic by Toptal

Do some testing – find your goldilocks zone

If you have the know-how or are willing to learn it, some testing may be of great value. Edward Scott’s article talks about testing (in an e-commerce setting) and verifying that there is a goldilocks zone for line length, not too long and not too short.

It turns out that the subconscious mind is energized when jumping to the next line (as long as it doesn’t happen too frequently; see above bullet point). At the beginning of every new line the reader is focused, but this focus gradually wears off over the duration of the line (“Typographie”, E. Ruder).

During our e-commerce testing, we’ve verified these basic readability precepts for users who are navigating e-commerce sites.

Readability: The Optimal Line Length, Edward Scott, Baymard Institute

Accessibility of writing

Nick Awad talks about website readability as an accessibility factor. He says that good formatting (which we have talked about a lot) is important but so too is accessible language.

A key component of readability is the language chosen for written content. Opt for simple language that resonates with a wide array of readers. Clear communication often outweighs complex vocabulary. For example, use simpler words like “use” instead of “utilize.”

Website Readability, Nick Awad, accessibility.com, 2024

Nick Awad also lists some tools that can be used to check accessibility in terms of reading ease, contrast, and simplicity.

  • Web FX Readability Test- This tool evaluates readability based on a provided URL.
  • Readability Formulas Scoring SystemThis tool uses various formulas to measure the readability of input text. These formulas account for sentence length and word complexity to estimate the text’s readability. 
  • Hemingway Editor– Beyond traditional readability scores, the Hemingway Editor identifies complex sentences, passive voice, and other potential content issues. It suggests ways to make the text more straightforward. 
  • WebAIM Color Contrast Checker– Readability extends beyond text complexity to presentation. This tool ensures the text has appropriate contrast against its background, essential for users with visual impairments and overall readability. 

Website Readability, Nick Awad, accessibility.com, 2024

I’d maybe add The Gunning Fog Index (or FOG) Readability Formula.

Harvard University stresses the importance of white space and resizing options

Harvard University’s website has a presentation on accessibility titled “Design for readability“. The unnamed writer talks about the use of visual and semantic space.

In arty terms, you need to give the text room to breathe. In terms of me, please keep distractions away from my focus so I can give my attention to the text I am reading.

For good accessibility support, you should support resizing, says Harvard.

Support text resizing. Check how your content responds to enlarged text. Avoid using narrow columns of content because they will not respond well to scaling.

Design for readability, https://accessibility.huit.harvard.edu/design-readability

Digital Accessibility, Willamette University

I’ve included this link mostly to provide a plurality of authoritative sources. Williamette covers a lot of ground mentioned already. They do provide a good summary of all the points, along with best practices for content organisation and visual display.

Like any good expert, they cite their courses. I’ve included those citations as further reading for anyone interested.

Digital Accessibility, Willamette University

Responsive design and font choices

Erik D. Kennedy writes in “The Responsive Website Font Size Guidelines“, going into depth about ideal sizes for different screen types. To get his point across (very well IMHO), Erik uses all the tricks of good writing – bullet points, headings, graphics, tables…

Talking of tables, here’s the one Erik opens with.

ElementMobileDesktopPage title28-40px35-50pxDefault/body text16-20px for text-heavy pages*,
16-18px for interaction-heavy pages*18-24px for text-heavy pages*,
14-20px for interaction-heavy pages*Secondary text, captions2px smaller than default2px smaller than default

Read The Responsive Website Font Size Guidelines for the full deep dive.

Conclusion(s)

I felt that I learned a lot during this research session. I’m pretty sure that I have yet to implement all the recommendations I have found here. Feel free to criticise me for that. It is a fair comment after all.

There are a lot of factors, from accessibility to optimal reading ease, to consider. Some parts are design aspects, others are a skill issue. That is okay, I think. If on each revision of our sites and blogs we factor in one more accessibility or good design aspect, our content will be better and easier to engage with.

Good font choice, layout, design, colour, and language use all contribute to an accessible and engaging web page. The more of these factors you get at least somewhat right, the better your content will be and the easier to engage with the content therein. In other words, if we want more readers, we (especially I) must work to improve accessibility and design within many factors.

Any improvement is, I think, a good thing. If each of us walks away from these articles with one nugget of truth and uses it, the web will be that much better for it.

Please comment, reply, or mention anything I have missed, misunderstood, or got wrong. Are there any design and content issues that you would add? How well do you think your blog or website meets this advice and best practice? (Mine could use work, I can see that.)

#accessibility #blogYourHomework #blogging #cited #design #fonts #layout #readability #typsetting #writing

Python data and variable types

I am a great believer in “blog your homework”. By homework, I mean (in this case) what I am learning about Python for my visual novel. In addition to my learning, I have two friends who are or are about to start using Python. This is a primer for all (3) of us.

Those who know their Python are invited to chip in if I missed anything or got something wrong. I’m here to learn too. There may be parts of this with updates from future me who just learned a thing.

What are variables

A quick refresher: Python, like most programming languages, has two things that are data-related:

  • Variables
  • Functions aka Mthods in some contexts
  • Variables hold data and functions do something with data. 2+3=5 is a function where 2 and 3 are variables and 5 is the new variable that + made. This is what it looks like in code.

    def adding(var,othervar): return var+othervarmyvar = 2myothervar = 3myanswer = adding(myvar,myothervar)print(myanswer) # 5

    Types of variable – in general

    Before we get to the depths of Python-specific stuff I want to revise variables in general.

    Most of this will also apply to things called constants which are values that cannot (or should not) change. Constants are a special case that I shall only tough on a bit.

    Boolean (bool)

    Booleans are the most primitive variable type. They can be True or False and that is it. This should relate to binary 1 or 0 but different languages handle them differently. On the whole, booleans are [1] or [NOT 1] but can also be [0] and [NOT 0] because screw consistency, I guess.

    Most languages have True and False as core contestants and it is best to use those. Python is no exception.

    Later note: False and 0 are considered the same in Python.

    Integer (int)

    Whole numbers (called integers by maths and computer science people) are something you will probably work with at some point. These are the variables in my silly example of variables vs functions.

    The number 42 is an int but 4.2 is not. That dot is what is different.

    Reals, floats, doubles and their friends

    These are all variables of various and fairly arbitrary precision. For now, the difference between these is not important. It might come up later but just think of numbers with a decimal point. That 4.2 (four point two) from earlier belongs here.

    If you cast (converted) 42 into one of these floating point types, you would get 42.0 or more likely 42.000000…

    Casting floats into ints gives you weird behaviour and maths errors. For example, push 3.14 (three point one four) and 4.2 through an adding function that outputs only ints, and you will get 7 (instead of 7.34).

    Personal peeve side story: When you see a number like 3.14 and you say “three point fourteen” please understand that I may wish to percusively educate you with a large plank of wood. This is because this number is three point one four. The only time you may call it three point fourteen if it is part of a version number like this: 3.14.0.2289. Otherwise, please slam your head in the door until you can say it properly.

    Char

    A single character like a letter or a number (as text). This will come up in database stuff as a common field type is varChar (variable characters).

    Array

    An array is basically a list of variables. The details vary between languages and Python gets fussy about them.

    An array has two parts – the index and the value.

    Here is a PHP example because I know PHP better and Python gets a bit complicated.

    $myarray = array('bannas','apples',12);$myarray[0] = 'Chips';$myarray[] = 'boats';$myarray['foo'] = 'bar';print_r($myarray);/*array( 0 => 'chips', 1 => 'apples', 2 => 12, 3 => 'boats', 'foo' => 'bar')*/

    Arrays index by number starting from 0 (most of the time). In Python, a negative index number is the point that number from the end. In PHP a negative index is just another index.

    Some arrays can have text (strings) as an index. In PHP that last array element also has a secret index value of 4.

    Try not to worry about this, things only get stranger from here.

    Strings

    We mentioned strings. Strings are characters all hanging out together in a single variable. This entire post is stored as a complicated string.

    Just to confuse you, some languages like Ruby don’t really have strings, they have arrays of char. Thus, you can grab any character you want from the string. A fair amount of languages now allow you to treat strings as pseudo-arrays (treat them like arrays even though they are strings).

    Strings have encodings. This is because there are a lot of languages with a lot of different characters. And now there are emojis as well. While this should not matter until you start processing external data or using databases, it will come up eventually. If in doubt, I use UTF-8. However, check with your data provider or database person because mismatched encodings give funny-looking results.

    Python defaults to UTF-8.

    Weak or strongly typed variables

    Sooner or later, you are going to come up against typing issues. For example:

    myStr = "42"myInt = 42myResult = myStr+myInt # what will you get from this?

    As this answer explains, in Python you will get an error. This is because Python is strongly typed and adding a number to text makes no sense.

    In PHP you will get “4242” because PHP is weakly typed and you just merged the int into a string like a complete noob.

    Classes (in general)

    Most programming languages have the concept of a class object. A class holds variables and has methods with are just functions that belong to the class. Python is one such language. If I mention classes (and I will because Python data types are classes) this is what I am on about.

    In python, you can use (dot) methods on classes.

    Variable Names

    It is said there are two hard problems in computer science – naming variables, invalidating cache, and off-by-one errors.

    In this example, I have named the variables so as to remind you what they are. This is terrible practice for anything that is not really basic notes. Please, name your variables something that describes what it is for. Your future self and whoever inherits your code will thank you.

    Don’t do this:

    n = 'bob'i=22tt = '01843 123456'

    You might know now what those variables are but will you always remember?

    Instead, do yourself a favour and do something like this:

    BobName = "Bob"BobID = 22BobTelephoneNumber = '01843 123456'

    There are better ways of handling names and numbers than this but at least you won’t come across code like this and wonder what it is about.

    if(i>23): tt=''

    What is that code even doing?

    Advanced example (skip if confusing)

    As per my snark about the “good” example not being good: Assuming you made a class called person in a library called myPersonThing, you can make Bob an instance of that.

    import myPersonThingBob = myPersonThing.person('Bob',22,'01843 123456')# Bob.Name = "Bob"# Bob.ID = 22# Bob.TelephoneNumber = '01843 123456'

    Note: When we come to dict(), you will have yet another way to approach this.

    Variable types: Python specifics

    This is where the blogging my homework comes in. While the basics are already covered, its time to get crazy. I’ll start us off slow.

    For reference, there is a proper list of Python’s built-in types here. You can add more via libraries but I am not covering those.

    Booleans

    Booleans work exactly as you should expect them to. They are True or False. 0 counts as False. Logical.

    AreYouAlive = Trueif AreYouAlive: breath()else: rot()

    A better example:

    UserCredits = GetUserCredits(Bob)if (UserCredits>0): print("Welcome citizen")else: print("Begone worthless fool")

    The boolean here is hidden inside the logical test (UserCredits>0). But that is a topic for another long post. The outcome is unknown but depends on what the GetUserCredits() function returns. Judging from the code, we are expecting a number.

    String (Str)

    The str type is exactly what you would expect.

    myStr = "42"print(type(myStr))

    You will get an answer that this is a class of type str. You remember I mentioned classes, string is a class (technically str is a class).

    This allows such behaviour as:

    myStr = "foo bar baz boo"myNewStr = myStr.capitalize()print(myNewStr) # Foo bar baz boo

    The capitalize() (note the spelling) method gives you a copy with the first letter capitalised.

    Other methods you may need for working with other data encodings may include this one:

    myStr = "foo bar baz boo"mySafeStr = myStr.encode('mac_latin2','ignore')

    This will give you a copy of the string converted (as best as Python can) to mac_latin2 bytes. Here is a list of all encodings.

    You can join strings together like this:

    myStr = "foo"myOtherStr = "bar"myNewStr = myStr+' '+myOtherStr # we add the two with a space in the middle (that's a string too)print(myNewStr) # foo bar

    Numbers

    Python, it turns out, has three number types.

  • int
  • float
  • complex
  • That third one was a surprise to me.

    Note: There is a fourth thing called a range but I covered it in the lists and arrays section like a fool.

    Int

    We covered integers in the general theory section. This is a whole number.

    Here is how you might use them.

    def adding(var,othervar): return var+othervarmyvar = 2myothervar = 3myanswer = adding(myvar,myothervar)print(myanswer) # 5

    A better function would check the inputs are a number type. Do not copy this for any real-world code.

    Float

    When you encounter reals, floats, doubles and their friends in database stuff, they are all floats in Python. You should remember (unless you skipped it) that floats are numbers with a decimal point (also called a floating point number).

    The number we all know and love – 3.1415926535… – is a float of (theoretically) infinite length. The longer your approximation of pi, the more accurate (and time-consuming) your maths will be.

    42 as a float is 42.000…

    If you don’t care about the precision, you can cast floats into ints but it is probably not a great idea.

    myFloat = 3.14159265print(int(myFloat)) # 3

    Here is a whole nerdy discussion about casting floats to ints for those who want to do that sort of nonsense.

    Complex (skip if confusing)

    Complex numbers are a fun part of maths that can make certain operations faster. For example, real-time radar. You might want to use them for making Mandelbrot fractal images.

    In regular mathematics complex numbers have a real and a complex part like this 5+2i. The complex value i is used. the number i is what you would get if there was an answer to what is the square root of -1 (minus one).

    In Python for reasons I am yet to work out, complex examples use i for the real part and j for the imaginary part. It is like someone read about the quaternions but only half remembered it.

    The complex is two numbers together and can be generated by the function complex() like this:

    myComplexNumber = complex(1,2) # 1+2imyComplexNumber = complex(1j) # 0+1imyComplexNumber = complex("9i+1j") # 9+1i

    For most of us, complex numbers are things we will not have to deal with. Unless you are doing some serious science or intensive recreational mathematics.

    Are lists arrays?

    Remember when I told you about arrays? Ah, the days of easy stuff. Get ready for some Python-specific confusion. This is where I trip up coming from PHP to Python.

    Allow me to introduce you to list, tuple, range, dict, set and frozen set. Yeah, I see that look. I had that same look on my face because I thought I would instantly understand this stuff.

    x = ["apple", "banana", "cherry"] # a listx = ("apple", "banana", "cherry") # a tuplex = range(6) # a rangex = {"Name" : "Bob", "ID" : 22, "TelephoneNumber" : '01843 123456'} # a dictx = {"apple", "banana", "cherry"} # a setx = frozenset({"apple", "banana", "cherry"}) # a frozen set

    Choose the wrong one and it will not behave how you were expecting. For me, I still think of these as types of arrays. It is probably better that you do not copy me.

    Let’s look at them one by one.

    List

    This is what other languages would call a numerically index array. List items are ordered, changeable, and allow duplicate values. They are indexed numerically from 0. This is where you can try for a negative index and get not what you thought you would get. At least I did.

    x = ["apple", "banana", "cherry"]print(x[0]) # appleprint(x[-1]) #cherryprint(x[2]) # also cherryprint(x[1]) # banana

    Did you want to add a new item to your list? Sorry, you will have to make a new list that is one entry bigger.

    Tuple

    Tuples are a bit hard to explain. Python is the only place I have ever encountered them.

    After a bit of reading, I can tell you this.

    A tuple is like a list in that they are ordered and allow duplicates except the order cannot change and the values inside cannot change. You use round brackets to make them.

    x = ("apple", "banana", "cherry")

    Here’s a link if that was a bit unclear.

    Range

    The range is probably not really meant to be here. It is an ordered range of numbers.

    The range function takes up to three arguments (values needed to use it). Like this: range(start, stop, step) – unless you only supply one – let me explain that.

    x = range(6) # 0 1 2 3 4 5 - stop givenx = range(3, 6) # 3 4 5 - start and stop givenx = range(3, 20, 2) # 3 5 7 9 11 13 15 17 19 - start, stop, and step given
    • start: Where you start from if you only give one argument, it will not be this one.
    • stop: Where you stop (not included)
    • step: Defaults to 1 but can be anything. To use this you need three arguments.

    Another example. Say you want all the multiples of seven less than one hundred.

    x = range(7,100,7)for n in x: print(n)

    That prints only the numbers we want.

    I guess you get a sort of ordered tuple?

    Dictionary aka dict

    This is what I, as a PHP programmer, would call a string-indexed array. As of newer versions of Python dictionary types are also ordered (they have a numerical index).

    Dicts (try saying that out loud at work) are key-value pairs. Like field and value on a form. Each key must be unique.

    Bob = { "Name" : "Bob", "ID" : 22, "TelephoneNumber" : '01843 123456'} # make the dictBob['xp']=400# you can also have more than one value by adding a tuple or a list or another dictBob['awards']=['Best Coder','Worst Farts','Employer of the year 1066'] # this list is now an entry in the dict

    Note: there is no comma after the last entry in the initial dictionary definition.

    In my opinion, if you need an arbitrary blob of data, dicts are usually what you want. That said, you will discover custom classes soon enough and you may want to use those.

    Sets

    As I write this, I haven’t a clue what sets are but I really hope they relate to set theory or are numerical random access changeable array things.

    Nope, sets are more like set theory than data theory.

    A set is an unordered unchangeable grouping. You cannot edit the items but you can remove items and add items. So, get item, remove it, make changes to the got item, and put it in again.

    x = {"apple", "banana", "cherry", True, 99}print(len(x)) # 5x.discard("banana")print(len(x)) # 4#There is also a remove method but it throws an error if the thing is not there.x.remove("banana") # you just crashed the program noob

    You can do some other stuff with sets. Popping for example.

    offering = {"space", "adventure", "really wild things"}x = offering.pop()print(x) # you will get one of the things in offering.fixedIt = x.capitalize()offering.add(x) # put it back

    We can also add other listy groups into a set

    offering = {"space", "adventure", "really wild things"}avoiding = {"milk","cookies","an early night"}offering.update(avoiding)print(offering) # {"space", "adventure", "really wild things","milk","cookies","an early night"}

    We can add those tuples and lists in the same way.

    offering = {"space", "adventure", "really wild things"}avoiding = ("milk","cookies","an early night")offering.update(avoiding)print(offering) # {"space", "adventure", "really wild things","milk","cookies","an early night"}

    Pay close attention – those last two may look nearly identical but they are not the same even if the output is. These things look like other things issues will trip you up if you are not careful.

    Frozen sets

    x = frozenset({"apple", "banana", "cherry"}) # a frozen set

    A frozen set is like a set but you cannot change it. I’d have called that a constant but no one asked me.

    And now we get into the weeds

    Here we look at four odd fellows – bytes, bytearray, memoryview, and NoneType sounds a lot like The Null Hypthoisis if you ask me.

    Each of these I learned about so I could write them down. They were all new to me.

    Bytes

    For some reason, you want the string as raw data (make sure you pick the encoding). You cannot change data of this type.

    This is the type you get if you convert a nice well-behaved string into a specific encoding. You might want to do this to save a string in a format that is not UTF-8 because the people giving you the data are unrefined noobs or something.

    Bytesarray

    Yes, at last, an honest-to-goodness array. This is an array of bytes. You can change the array.

    I haven’t a clue what you would do with one of these. Maybe manipulate some strangely encoded text?

    Memoryview

    This is a memory-safe way of looking into memory. NGL, this is all new to me. Here’s a post about it.

    NoneType

    It turns out that NoneType represents the distinct lack of anything. This SE answer explains it better than I could.

    It is a good idea to check a return object against NoneType before using it.

    obj = myUnreliableFactoryMethod(foo,bar)if obj is None: # throw an error or somethingelse: # do something clever

    And that’s a wrap

    We have looked at all the built-in variable types and the functions that make them. I half-arsed a few of the more esoteric ones at the end because my brain is melting.

    I think I learned something. I hope you did too.

    Feel free to pass judgment, offer corrections, or expand on something. I’m here to learn. Also, please ask questions if I was unclear or if you want to know more. If I can answer, I will. Otherwise, I will go away and learn the answer for you.

    Welcome to your new life as a Python geek.

    Syndicated to:

    #blogYourHomework #cherry #Python #There #variables #CodingAndDevelopment

    Read the whole post

    why integer cannot add with string

    n=int(input('Enter any number :')) str1="" for i in range(1,n+1): str1+=n print(str1) I tried the above mentioned code and it gave me typeerror and My expectation is e.g n=5 output : 1...

    Stack Overflow