Wednesday, June 19, 2019

Taking input from user using python

Example 1:

s = input("What is your name?\n");
print("HELLO ", s);

output:
What is your name?
anil
HELLO  anil



Example 2:

x = int(input("Input an integer: "))
y = float(input("Input a float: "))
print(x, y)

output:

Input an integer: 2
Input a float: 2.5

2 2.5

No comments:

Post a Comment

python class topic video