Check the input type from the user.

In this program, we will check the input type from the user and perform actions according to it.

Steps to solve the program
  1. Take input from the user and create an empty list.
  2. If the type of input is a string then add it to the empty list using for loop.
  3. Print the output.
				
					data = input("Enter your text: ")
List = []

if type(data) == str:
    for char in data:
        List.append(char)
        
print(List)
				
			

Output :

				
					Enter your text: sqatools007
['s', 'q', 'a', 't', 'o', 'o', 'l', 's', '0', '0', '7']
				
			

get input from the user if it is a number insert it into an empty list

Calculate the bill according to the distance covered

Leave a Comment