Skip to content
Advertisement

Tag: reverse

How to reverse an int in python?

I’m creating a python script which prints out the whole song of ’99 bottles of beer’, but reversed. The only thing I cannot reverse is the numbers, being integers, not strings. This is my full script, I understand my reverse function takes a string as an argument, however I do not know how to take in an integer, or ,

Print a list in reverse order with range()?

How can you produce the following list with range() in Python? Answer use reversed() function: It’s much more meaningful. Update: If you want it to be a list (as btk pointed out): Update: If you want to use only range to achieve the same result, you can use all its parameters. range(start, stop, step) For example, to generate a list

Advertisement