Hello, this time, I think that trying to do a sequel to the python print function've done before. To put it simply, I would like to assign a number or character to a variable and output it as a character string.
First of all, if you don't know how to assign letters and numbers to variables, you can't talk about it. So first I would like to explain how to assign variables.
First, variable assignment is written like this.
hensuu.py
x = "XXXXX"
This means assign the string XXXXX to the variable x. Next, let's substitute a number.
hennsuu.py
x = 100
It's done. The meaning is to substitute the number 100 for the variable x. Let's move on to today's main.
Finally, assign it to the print function. First, let's prepare a variable.
hensuuprint.py
x = 10
There is no signal to do it, but it's okay. Next, let's output it.
hensuuprint.py
print(x)
Execution result
hensuuprint.py
10
Should come out. Now, let's output the characters. First, prepare such a variable.
mozihensuu.py
a = "a"
Please be careful not to forget to enclose with double quotes. Let's output it.
mozihensuu.py
print(a)
When you run
mozihensuu.py
a
I was able to ok. When you output a variable like this, don't enclose it in double quotes. Did you notice?
In this statement, I wrote to output a variable. that's all This time, I couldn't give a very good explanation. So if there is something that is easier to understand with this kind of explanation, I would be grateful if you could write a comment.
Recommended Posts