Identify the syntastical errors in the following piece of code and rewrite the code after removing them.
def swap ():
a=input' Enter first number'
b=input 'Enter second number'
print (a,b)
b, a = a,b
print (a,b)
Answers
Answered by
1
Answer:
Python has two functions designed for accepting data directly from the user:
Python 2.x. -> raw_input()
Python 3.x. -> input()
raw_input():
raw_input() asks the user for a string of data and simply returns the string, the string data ended with a newline). It can also take an argument, which is displayed as a prompt before the user enters the data.
print raw_input('Input your name:
Similar questions