How to reverse an int in python? -


I am creating a dragon script which prints the '99 bottles the whole song of the bottle, but is inverted. The only thing that I can not reverse is the number, the integer is not the string.

This is my complete script, def reverse (str): return str [:: -1] DERT plural (word, b): If B! = 1: return word + 'a': return word defline (b, ending): print be or reverse ('no'), plural (reverse 'bottle'), b), range (1 99 0, -1 ) Reverse (ending): line (i, "beer on the wall") line (i, "beer" print reverse ("lo

I understand that my reverse function argument Takes a string as though I do not know how to take an integer, or, how can I change an integer later in the script

You are conveying it in a very strange way. You already have a reverse task , Then why not line make the line line normal way ?

  def line (bottles, ends): "{0} { Return to "{2}." Format (bottles, plural ("bottle", bet les), closing)   

that runs in this way:

 Beer 49 bottles on the wall.   

Then return the result to reverse Pass on :

  & gt; & Gt; & Gt; Reverse (49 ("beer on the wall" (line, 49) 'llaw eht no reeb fo selttob 94' '  

This makes it easy to check and see each part of the code separately What is happening when you put it together.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -