Today I will discuss the variables and string and data inputs. Before that we had an overview of the old issues. Like the previous episode, we print something down below.
Write all in Python's New Window:
And see these results by running them.
Variable and string : Variable is an object that stores different data. And the string is the data that is stored in the variable. If you look down, the matter will be more clear.
Here a and b are two variable. And 12 and 25 are two strings that are stored in the variable. Write now
See now pithon a, b instead of b, print a value of b or string.
Enter the following program:
Here I have given a, b and another variable c which add value to it. Then I asked to print that c variable.
Write down the code and print the value of a + b in Python c.
You can also write:
If you want to take a number as a string, it will be written as an example. But to pick any character, it must be written in "". Such as:
AppleoRange has been printed on the watch screen.
Write this now:
See apple printed 5 times.
Python Input : The process that is stored with information from the user with the help of that input is called input.
Python input is three types.
Any character input, such as someone's name, email etc.
Method: input ("enter your name here:") (Only for the alphabets)Any number (excluding decimal). Such as a password which is made up of numbers only.
Method: int (input ("Enter your password here:"))Any number including demos.
Method: float (input ("Enter your number:"))
Now let's make a little fun program that will find a man's death day according to your order:
Save it with .py. Let's double click on it to run. Give inputs to the data well and see it as your death.
Explanation: Here we primarily
print ("Lets know when you will die") to give the user an idea about the program.
Then we know the username by n variable.
A user has learned the age of a variable.
Now we have created a variable called c, which we have ordered to subtract the value of a variable from 2075. And we printed it as n the death day. That is, our program will print its death date, because the age of the person is not inputable, or by subtracting that input from 2075.
Then again we wanted to have user feedback and input via input.
In this way, you have to create more small programs like yourself and continue to practice. To this day. If anyone can not understand anything then tell the comment. We will try to conform to the extent possible.