Input in Python in 60 seconds or less!

 

Input allows a user to add data to a variable for use later in the programme. This is great if you want to ask the user for anything such as their age or anything else!

by default Python always assumes all input data is a string datatype.

To change this wrap the input function within the  int() function to convert input data to an integer;

varx = int(input())

 

and wrap the input function within the  float() function to convert input data to a decimal number.

varx = float(input())

 

Series links

Posted in Uncategorized.

Leave a Reply

Your email address will not be published. Required fields are marked *

*