Skip to content
Pooja Bhatia Classes Hari Nagar
  • We teach following classes
    • Class 12
    • Class 11
    • Class 10
    • Class 9
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship
Pooja Bhatia Classes Hari Nagar

11 cs 7 BE A

15. If you give the following for str1 = “Hello”, why does Python report error? str1[2] = ‘ p ‘

sa 11 cs chapter 7, sa 11 ip chapter 4, Uncategorized / PythonCSIP CS IP

This reports an error because strings are immutable and its in place value can’t be changed but a complete string can be changed because then it just points to a new memory location. For instance str1 = ‘World’ is valid.

15. If you give the following for str1 = “Hello”, why does Python report error? str1[2] = ‘ p ‘ Read More »

13. Two objects (say a and b) when compared using == , return True. But Python gives False when compared using is operator. Why ? (i.e., a == b is True but why is a is b False ?)

sa 11 cs chapter 7, sa 11 ip chapter 4, Uncategorized / PythonCSIP CS IP

This is because a and b both have the same value but their addresses are different i.e. they refer to different memory locations.

13. Two objects (say a and b) when compared using == , return True. But Python gives False when compared using is operator. Why ? (i.e., a == b is True but why is a is b False ?) Read More »

Post pagination
← Previous 1 … 12 13 14 … 16 Next →
  • We teach following classes
    • Class 12
    • Class 11
    • Class 10
    • Class 9
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship
  • We teach following classes
  • Sumita Arora IP/CS Solutions
  • Jobs/Internship

Copyright © 2025 Pooja Bhatia Classes Hari Nagar | Powered by Pooja Bhatia Classes Hari Nagar.