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.
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.
Taro, Donmai.
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