QrDroid



Sharecodepoint popular queries

Saturday, 1 December 2018

How to taking the integer input value from user & print that value in phython

This example in on how to take the integer value from the user and print the value. I will show the simple and easy example to understand.

To taking input form the user we use input() function. Input function ask a user for some text input. If you want to taking string value from user then you use str(input()) & if you want taking input integer value from the user then use int(input()). 

Syntax : 
1. variable_name = int(input()) #syntax for taking input value

2. variable_name = str(input()) #syntax for taking string valure

3. variable_name = int(input('Enter the value ')) 
Python Code :
print('Enter the your phone number : ')
phone = int(input())
print("Your phone number : +91 -",phone)
Comment in python start with the #hastag like : #comment_line. Using #hastags you simply apply in single line but if you want add in the next line then you use again #. Hashtags comment not use for multiple line. only use single line comment.

Output :

Enter the your phone number : 
7011258995
Your phone number : +91 - 7011258995

Process finished with exit code 0

0 comments:

Post a Comment

 

Version 20.2.1 - 2016 - 2018 - © Sharecodepoint | Made in India. | Copyright Content