Skip to main content

13.Python Input

PYTHON INPUT 
    In python,it is possible to ask the user for input in order to enhance the flexibility.To get the user input ,the input() method is used.However,Python 2.7 uses the raw_input() method. input() method is widely used for standard input operations. 

Syntax 
input([prompt]) 
Program
a=input("write something: ")#Write something is the string/prompt 
b=input("enter a number: ") 
print("Welcome to",a) #comma leaves space automatically 
print("Welcome to"+a) #plus does not leave space 
print("number="+b) 
Output
write something: Tamil Hacks 
enter a number: 88 
Welcome to Tamil Hacks 
Welcome toTamil Hacks 
number=88 
Note that the input is taken as a string,to convert it to the desirable data type,Type casting is used.
suppose,the user input must be an integer,you need to specify int before input()
Syntax 
int(input([prompt]))
float(input())
str(input())
list(input())...
Program
a=int(input("write something: "))#Write something is the string/prompt 
b=float(input("enter a float number: "))
c=list(input("list:"))
print(a) #comma leaves space automatically 
print(b) #plus does not leave space 
print(c) 
Output
write something: 88
enter a float number: 8.88 
list:Tamil Hacks 
 88
8.88
['T','a','m','i','l','h','a','c','k','s']
Do check out the link below to know more about input()!!
Watch the video below to know about python in detail!!


Happy Learning!!

Comments

Popular posts from this blog

Get Ethical Hacking Project #1

Thanks for your interest in our course This is a paid course, 150 rs for Indian people, 5$ for international people Instructions to get course: Indian people can get the course by paying using this UPI id   tamilhacks@ybl  (KARTHIKEYAN T) send 150 Rs to this upi id with subject bug bounty and after payment take a screenshot and send that to email id tamilhackstech@gmail.com - you will get the course within 24 hours. (there will be no tax, when paying using upi id)     The above mentioned method is most preferable. if you don't have a upi id app, install  phonepe  or  google pay   app and register there and pay easily  or  pay here using the alternate method to get this course, this link cost 18% gst for the course . (nearly 30-100 Rs for tax and other charges here )   After payment you will receive a payment confirmation mail along with a downlink for the course, you can download the course file using that . the course is in zip format, so after downloading the file extra

Learn c++ in Tamil | Complete guide and tutorial | Beginner to Advance all concepts explained.

hi guys welcome , all the coding used in video are available here : /* hi guys welcome to learn c++ in tamil what is C++ how what software your own program schools,clg,institute.... start 1.interest 2.patience 3.fun 4.practise computer program - app - programming source code - hardware - fb running , executing machine language :  101010 assembly lang : mov h1; high lang : c , c++....java , js , python  eg :  a+b .....1001010  compiler :  human to machine              machine to human  rules :  a+b;  usage:  games, manufacturing , embedded , finance , graphics , etc...  Guide: 1.problem 2.solution - alternative 3.program  - C++ 4.compile  - turboc , ide , codeblocks , cmd 5.result   - library file - linker : #include<iostream.h>    input , output std::cout<<"welcome";   standard character out << " "; primary section : 1.statements   ;  end 2.functions   main() 3.syntax  , syntax error pra

Get Bug Bounty Course

Thanks for your interest in our course Limited Offer This is a paid course, Rs 10000 ,Rs 1000  for Indian people, 75$ 15$ for international people , 50$ 10$ for Srilankan people Instructions to get course: Indian people can get the course by paying using this UPI id  tamilhacks@ybl  send 1000 Rs to this upi id with subject bug bounty and after payment take a screenshot and send that to email id tamilhackstech@gmail.com - you will get the course within 24 hours. (there will be no tax, when paying using upi id)    The above mentioned method is most preferable. if you don't have a upi id app, install phonepe or google pay   app and register there and pay easily  or  pay here using the alternate method to get this course, this link cost 18% gst for the course . (nearly 30-100Rs for tax and other charges here ) After payment you will receive a payment confirmation mail along with a downlink for the course, you can download the course file using that. As for international peopl