Python print function (sequel)

Introduction

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.

Variable assignment

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.

Let's assign it to the print function

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?

Summary

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

Python print function (sequel)
python function ①
[Python] function
python function ②
python enumerate function
Python> function> Closure
[Python] Generator function
Python> function> Inner function
Python function decorator
About function arguments (python)
Function execution time (Python)
Python function argument summary
Python: About function arguments
Time floor function (Python)
Create a function in Python
Use callback function in Python
[python] Value of function object (?)
ntile (decile) function in python
[Python] Etymology of python function names
python> print> N line breaks> print ('\ n'* 3)> 4 line breaks> print ('\ n'* 3),> 3 line breaks
About python beginner's memorandum function
python url setting include function
Python #function 2 for super beginners
Nonlinear function modeling in Python
Draw implicit function in python
Python higher-order function (decorator) sample
Immediate function in python (lie)
python> Get substring> print serial [5:10] / print serial [5: -1]
[Python] What is a zip function?
Call a Python function from p5.js.
[python] Callback function (pass function as argument)
Implement R's power.prop.test function in python
Function argument type definition in python
Python
Included notation in Python function arguments
Print with python3 without line breaks
Write AWS Lambda function in Python
Measure function execution time in Python
[Python] Make the function a lambda function
[Python] Be careful when using print
Python #len function for super beginners
Function synthesis and application in Python
Basic Python operation 2nd: Function (argument)
How to use python zip function
[Python] Difference between function and method
[Python] Function arguments * (star) and ** (double star)
[OpenCV; Python] Summary of findcontours function
Python3> Functions> Function Renaming Mechanism> f = fib
Create a Python function decorator with Class
Use print in a Python2 lambda expression
Precautions when pickling a function in python
[Introduction to Udemy Python3 + Application] 48. Function definition
Just print Python elapsed time in seconds
OR the List in Python (zip function)
[python] How to use __command__, function explanation
Decorator to avoid UnicodeEncodeError in Python 3 print ()
[Introduction to Udemy Python3 + Application] 41. Input function
[Python3] Rewrite the code object of the function
Function to save images by date [python3]
Learn Python! Comparison with Java (basic function)
[Introduction to Udemy Python3 + Application] 44. range function