How to Python Important things for 2026

admin
By -
0



How to take two separate inputs in Python using a single line of code, but treating them as if entered on two separate lines?

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

In this code:

  • n takes the first input as an integer (int(input())).

  • m takes the second input as a space-separated list of strings (input().split()), where the split() method splits the input into individual components based on spaces.

Even though both inputs are on the same line of code, this effectively simulates two separate inputs, as m is treated as a list (from the space-separated input) and n as an integer.

Alternatively, the code could be split into two lines as:

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

Here, n is assigned the integer value from the first input, and m is assigned the space-separated values from the second input, treated as a list of strings.


How to consider the non-negative number?

If element or number is greater than or equal to  zero that  means its non-negative
cause reale number

num <=0
5<=0

 e.g. 4 is bigger than 0 
4,5,8,9, all whole and real number if bigger than the 0



Post a Comment

0Comments

Please Select Embedded Mode To show the Comment System.*