Sep-28-2018, 10:00 AM
In my earlier post, Customised Learning, I tried to run a GUI code. Its an ancient code. Didn't run.
What i further observed is that python platform is very dynamic and fast changing. So some codes become redundant.
So I am now trying to update the code to my installed version. i run:
Then searched the in-built function, raw_input
Found here. InteractiveConsole.raw_input(prompt="")
The CLI code with proper indentation is here:
Without examples, i am stuck. When i write:
What i further observed is that python platform is very dynamic and fast changing. So some codes become redundant.
So I am now trying to update the code to my installed version. i run:
python3.3 --versioni get:
Output:Python 3.3.2+
So switched to the page: The Python Standard Library 3.3.2Then searched the in-built function, raw_input
Found here. InteractiveConsole.raw_input(prompt="")
The CLI code with proper indentation is here:
# tutCLI.py: # Code: class adder: result = 0 def __init__( self, number1, number2 ): self.result = int( number1 ) + int( number2 ) def giveResult( self ): return str(self.result) endIt = False while ( endIt == False ): print('Please input two intergers you wish to add: ') number1 = raw_input("Enter the first number: ") number2 = raw_input("Enter the second number: ") try: thistime = adder( number1, number2 ) except ValueError: print ("Sorry, one of your values was not a valid integer.") continue print ("Your result is: " + thistime.giveResult()) goagain = raw_input( "Do you want to eXit or go again? ('X' to eXit, anything else to continue): " ) if ( goagain == "x" or goagain == "X" ): endIt = Truei have not learnt to look at specific examples for the classes, like for example, InteractiveConsole.raw_input() I wish to replace the ancient raw_input() here.
Without examples, i am stuck. When i write:
python3.3 tutCLI.pyi get the output:
Output:Please input two integers you wish to add:
Traceback (most recent call last):
File "tutCLI.py", line 18, in <module>
number1 = raw_input("Enter the first number: ")
NameError: name 'raw_input' is not defined
How to look up a modern version of the ancient classes? And then specific examples for that class?