Popular posts from this blog
DATA TYPES IN PYTHON
Integer and Float • Variables can hold values of different types called data types. Some of the commonly used data types in python are integer, float, bool, strings, lists, tuples, dictionary, sets, etc • The data type of a variable is dependent on the value of the variable. For example, if the value of the variable userAge is 18 i.e userAge = 18 Here the data type of the variable is an integer. • For float data type the value of the variable should be a decimal. For example, if you create a variable for the percentage of students in class studentPercentage with a value 78.5 i.e studentPercentage = 78.5 Strings • A string data type is used to store textual information into a variable. • To store the value of a string data type, we need to put the value inside double quotes 11 " or single quotes ''. For example schoolName = "Bright International" characterName = 'Eva' ...
INPUT AND PRINT
INPUT PYTHON allows a user to give input and based on that a program will proceed further. In python, we pass some value to input() so that it tell the user what to give input.let us look at the exmaple below; UserName= input ("Enter name:") Print ("The name of user is" + username) in the above example, the user is asked to enter his/name. if the user entered "Piyush", the output will be: The name of the user is Piyush. PRINT We use the print () function to output data to screen. for example; Print('this sentence is output to the) Output of the above code would be : this sentence is output to the screen We can also print the value assigned to a variable. a=5 print('the value of a is', a output of the above code would be the value of a is 5 # Print the string "Hello World" print("Hello World") # Create a variable named myName and # set it to input("enter your name") myName = input("enter your name");...

Comments