Home>Article>Backend Development> How to input multiple numbers at once in Python

How to input multiple numbers at once in Python

PHPz
PHPz Original
2020-09-25 15:49:42 51027browse

How to input multiple numbers in python at once: 1. Enter two numbers [m, n = map(int, input().split());]; 2. Enter three and three The above numbers [a, b, c, d = map(int, input().split());].

How to input multiple numbers at once in Python

Related learning recommendations:python tutorial

How to input multiple numbers at once in python:

1. Enter one number directly

m = int(input())

2. Enter two numbers and it will be

m, n = map(int, input().split())

3. Three or more numbers will be similar to two:

a, b, c = map(int, input().split()) a, b, c, d = map(int, input().split())

Extended information

Python’s expression writing method is similar to C/C. There are only differences in some writing methods.

The main arithmetic operators are similar to C/C. , -, *, /, //, **, ~, % respectively represent addition or positive, subtraction or negative, multiplication, division, integer division, exponentiation, complement and remainder. >>, d4b5c49b0972ea5ab831c12957dbe5cf, cdec70a48fcacbe69995d004de52ba27= is used to compare the values of two expressions, indicating greater than, less than, equal to, not equal to, less than or equal to, and greater than or equal to. Among these operators, ~, |, ^, &, 071af19a55f4da1989e8c02b755ba052> must be applied to integers.

Python uses and, or, and not to represent logical operations.

is, is not is used to compare whether two variables are the same object. in, not in is used to determine whether an object belongs to another object.

The above is the detailed content of How to input multiple numbers at once in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn