Mayungo's Python Learning Episode 2: I tried to put out characters with variables

Mayungo Mayu Mayu

This time, as it is the second episode, we will put out characters from variables.

If you are new to this page Please also see Episode 1.

Also, the same content as this page is also published in the video, so if you prefer the video, please take a look.

Last time, I tried to put out the words of animation with print ().

print("Exactly DEATH ☆ GAME! !!")
Exactly DEATH ☆ GAME! !!

print("Monster card! !! !!")
Monster card! !! !!

You need "" "and"'' "in print ().

Only those inside "" "" and "''" are displayed.

However, if the same word appears many times here and there, writing it one by one will make the code longer and harder to read.

print("Monster card! !! !!")
print("Monster card! !! !!")
print("Monster card! !! !!")
print("Monster card! !! !!")
print("Monster card! !! !!")

Monster card! !! !!
Monster card! !! !!
Monster card! !! !!
Monster card! !! !!
Monster card! !! !!

So we use "variables".

Put the "monster card" in the box named card and the "death game" in the box named message.

Let's print the card and message immediately.

card = "Monster card! !! !!"
message = "Exactly DEATH ☆ GAME! !!"

print(card)
print(message)

At this time, only the name of the variable is put in ().

The reason why "" "" and "''" are not entered here is that the name of the variable itself will appear as characters if used.

Monster card! !! !!
Exactly DEATH ☆ GAME! !!

It came out without writing words one by one.

If you do not make a mistake in the variable name, the same thing will be displayed even if you change the place or order.

print(message)
print(card)

Exactly DEATH ☆ GAME! !!
Monster card! !! !!

Finally, put the request in a variable called onegai and display it.

onegai = "Thank you for subscribing to the channel"
print(onegai)

Thank you for subscribing to the channel

Thank you again for this time.

Click here for a list of each story.

Recommended Posts

Mayungo's Python Learning Episode 2: I tried to put out characters with variables
Mayungo's Python Learning Episode 3: I tried to print numbers with print
Mayungo's Python Learning Episode 1: I tried printing with print
Mayungo's Python Learning Episode 8: I tried input
Mayungo's Python Learning Episode 7: I tried printing with if, elif, else
Mayungo's Python Learning Episode 6: I tried to convert a character string to a number
I tried to put out the frequent word ranking of LINE talk with Python
I tried to find out if ReDoS is possible with Python
I tried to get CloudWatch data with Python
I tried to output LLVM IR with Python
I tried to automate sushi making with python
Mayungo's Python Learning Episode 4: I tried to see what happens when numbers are treated as letters
I tried to move machine learning (ObjectDetection) with TouchDesigner
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to draw a route map with Python
I tried to solve the soma cube with python
I tried to get started with blender python script_Part 02
I tried to implement an artificial perceptron with python
I tried to automatically generate a password with Python3
I tried to solve the problem with Python Vol.1
I tried to analyze J League data with Python
I tried to solve AOJ's number theory with Python
I tried fp-growth with python
I tried scraping with Python
I tried gRPC with Python
I tried scraping with python
I tried to make a real-time sound source separation mock with Python machine learning
I tried to find out how to streamline the work flow with Excel x Python ④
I tried to find out how to streamline the work flow with Excel x Python ⑤
I tried to find out how to streamline the work flow with Excel x Python ①
[Uncorrelated test] I tried to put out the boundary line with or without rejection
I tried to find out how to streamline the work flow with Excel x Python ③
I tried to build an environment for machine learning with Python (Mac OS X)
I tried to find the entropy of the image with python
I tried to simulate how the infection spreads with Python
I tried various methods to send Japanese mail with Python
[Python] I tried to visualize tweets about Corona with WordCloud
I tried to implement ListNet of rank learning with Chainer
I tried to make GUI tic-tac-toe with Python and Tkinter
I tried to divide the file into folders with Python
I tried to divide with a deep learning language model
I tried to touch Python (installation)
I tried machine learning with liblinear
I tried web scraping with python.
I want to debug with Python
I tried running prolog with python 3.8.2.
python beginners tried to find out
I tried SMTP communication with Python
I tried learning LightGBM with Yellowbrick
[5th] I tried to make a certain authenticator-like tool with python
I tried to solve the ant book beginner's edition with python
[2nd] I tried to make a certain authenticator-like tool with python
[3rd] I tried to make a certain authenticator-like tool with python
[Python] A memo that I tried to get started with asyncio
I tried to create a list of prime numbers with python
[Pandas] I tried to analyze sales data with Python [For beginners]
I tried to fix "I tried stochastic simulation of bingo game with Python"
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python