How to input two numbers at once in python

Release: 2019-07-06 10:00:53
Original
25564 people have browsed it

How to input two numbers at once in python

Enter multiple numbers in Python:

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

1 , Enter a number directly m = int(input())

2. Enter two numbers directly, m, n = map(int, input().split())

3. Three or more are 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. >>, << means right shift and left shift.

&, |, ^ represents binary AND, OR, XOR operations. >, <, ==, !=, <=, >= 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, ~, |, ^, &, <<, >> 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.

For more Python related technical articles, please visit the Python Tutorial column to learn!

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template