what will be the output #developer #memes #coding #codinglife #programmer #problemsolving

preview_player
Показать описание
what will be the output #developerlife #memes #coding #codinglife #programmer #problemsolving developer,coding,programmer,software developer,web developer,codinglife,app developer,programmers,programming for kids-learn coding free,learning programming through games,lets encode the logic,coding memes,youtube channel for coding,javascript coding interview questions,beginner coding,introduction to coding,helpful channel for coding,programmer life,the c programming language,coding time,coding tutorial,programmers life,code runs without output,
python interview questions,coding interview,python coding interview questions,python interview,python coding interview questions and answers,python interview questions and answers,coding interview questions,python coding interview,python,python interview questions for freshers,coding interview preparation,python programming interview,problem solving,cracking the coding interview,coding problem solving,job interview,python problem solving
Рекомендации по теме
Комментарии
Автор

1. Answer will depend on which version of interpreter this code is run and whether or not it's an interactive mode.
2. Knowing exact answer is useless. It's good to know however that comparing immutable objects with "is" could lead to false positives due to optimisations if dine mindlessly.

evlezzz
Автор

' is ' operator will check weather the address is same or not where the == operaton check weather the values are equal or not, in python there is a different concept where the variables will be taged to the memory location rather than creating new memory location for same value

codelikapro
Автор

I would guess False since I dont really remember. If I could remember primitive types like integer, float and bool is always duplicated in Python. 'is' basically an operator to check whether 2 data shares the same memory address, usually useful to assert whether u are mutating the same object.

afterschool
Автор

False
False
Cuz a and b, and x and y don't have same id. U can check variable id with
id(x)

thatoneracist
Автор

True
True.

Since they point to the same memory location (unless you're using an ollllddd computer with low ram, then x & y might point towards different memory location and result in false)

Novisor
Автор

False
False
In Python, the operator verifies only the memory address of the variable and does not evaluate the equality of its value.

HI_BYDDY
Автор

True
False

Operator "is" equals object's id in ROM
Nums from -5 to 256 has same places in memory forever. (Sorry for my bad english)

argentumag
Автор

This is genius because you get people to comment which increases the engagement

NickGherr
Автор

It'll be an error coz there's no "void main() {}"

nightlion
Автор

True
False
I am too good at python, but not the best

animemchik
Автор

Output will be
True
False

Explanation
a is b returns True

In Python, small integers from -5 to 256 are interned, meaning they are stored in a fixed memory location.

Both a and b point to the same memory location for 256, so a is b evaluates to True.

x is y returns False

Numbers outside the interned range (257 and beyond) are not guaranteed to be stored at the same memory location.

So, x and y are separate objects in memory, making x is y evaluate to False.

prathambhatt