Create a compatibility judgment program with the random module of python.

Introduction

This is a beginner's play.

Feel free to read it.

This time, I made a program to judge the compatibility with that child who is often seen on the net.

Program creation

Let's make it.

The aim this time is to "enter the names of the two people you want to judge and express the compatibility of the two people in%".

Use the random module for the% display part.

This module has a random function that displays random numbers between 0 and 1. This time we will use this.

The following is a brief summary of the behavior of the program. ① Ask them to enter their names and receive them. ② Convert to% using random numbers ③ Output the result

If these are converted into a program, it will be as follows.

import random#Import random
male = input('Please enter the name of the man: ')#①
female = input('Please enter the name of the woman: ')#②

p = random.random()#②
p = p*100#②
p = int(p)#%Truncate after the decimal point in% display
print(male,'When',female,'The compatibility of',p,'%is')#③

That's it! !!

By the way, when you execute this, you will see the following screen. python画像.PNG

Taro, Donmai.

At the end

This time, I made a compatibility judgment program that is often found on the Internet.

What I learned from making this time is that it is made with an insanely simple program, and that even such a simple program can make people happy and sad.

Thank you for reading until the end! !! !! If you have any advice, please comment! !! !!

Recommended Posts

Create a compatibility judgment program with the random module of python.
The story of making a module that skips mail with python
Create a Python module
[Python] A rough understanding of the logging module
Create a record with attachments in KINTONE using the Python requests module
[Python] A program that counts the number of valleys
[Python] Create a Tkinter program distribution file with cx_Freeze
Create a directory with python
[Python] A program that compares the positions of kangaroos.
A memo of misunderstanding when trying to load the entire self-made module with Python3
Measure the importance of features with a random forest tool
Probably the easiest way to create a pdf with Python3
Create a Twitter BOT with the GoogleAppEngine SDK for Python
Create a pixel art of Levi Captain with Python programming!
[Golang] A program that determines the turn with random numbers
Create a virtual environment with Python!
Create a random string in Python
The story of writing a program
Save the result of the life game as a gif with python
[python, ruby] fetch the contents of a web page with selenium-webdriver
Create a color picker for the color wheel with Python + Qt (PySide)
I tried to create a list of prime numbers with python
The story of making a standard driver for db with python.
Count the maximum concatenated part of a random graph with NetworkX
Read a file in Python with a relative path from the program
The idea of feeding the config file with a python file instead of yaml
[Python] A program that rotates the contents of the list to the left
Create a Python function decorator with Class
[Python] A program that creates stairs with #
[Python] Create a program to delete line breaks in the clipboard + Register as a shortcut with windows
Build a blockchain with Python ① Create a class
Pass the path of the imported python module
Check the existence of the file with python
Make a relation diagram of Python module
[Python] Create a virtual environment with Anaconda
Let's create a free group with Python
Create a graph using the Sympy module
Search the maze with the python A * algorithm
Check the path of the Python imported module
[python] [meta] Is the type of python a type?
Create a word frequency counter with Python 3.4
[Python] A program that finds the maximum number of toys that can be purchased with your money
Set the process name of the Python program
The story of blackjack A processing (python)
[Python] A program that rounds the score
[Python] A program that calculates the number of chocolate segments that meet the conditions
The story of making a university 100 yen breakfast LINE bot with Python
[AtCoder explanation] Control the A, B, C problems of ABC182 with Python!
Calculate the shortest route of a graph with Dijkstra's algorithm and Python
If you want a singleton in python, think of the module as a singleton
Get the number of searches with a regular expression. SeleniumBasic VBA Python
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
[Python] A program that calculates the number of socks to be paired
[Introduction to Python] How to sort the contents of a list efficiently with list sort
Test & Debug Tips: Create a file of the specified size in Python
Calculate the probability of being a squid coin with Bayes' theorem [python]
Hit a method of a class instance with the Python Bottle Web API
I get a Python No module named'encodings' error with the aws command
Receive a list of the results of parallel processing in Python with starmap
Install the python module with pip on a server without root privileges
[AtCoder explanation] Control the A, B, C problems of ABC187 with Python!