python2 to python3 converter 1

python2 to python3 converter

# example.py file 
def greet(name):
    print "Hello, {0}!".format(name)
print "What's your name?"
name = raw_input()
greet(name)

##It can be converted to Python 3.x code via 2to3 on the command line:
# 2to3 example.py

Here is what the above code is Doing:
1. It defines a function called greet that takes a single argument, name.
2. It prints a string that contains the name argument.
3. It asks the user for their name.
4. It stores the user’s name in a variable called name.
5. It calls the greet function with the user’s name as the argument.

Similar Posts