• Python question of the day

    k = 2
    s1 = 'a' * k
    s2 = "a" * k
    s3 = 'a' * 2
    s4 = "a" * 2
    After executing the code above, which of the following would print True
     print(s1 is s2)
     print(s1 is s3)
     print(s2 is s4)
     print(s3 is s4)
    In Python, single and double quotes are the same, but allocator is not able to determine that the content is the same, even if the size is the same, if we multiply string with a constant

    Top 100 python interview questions:

  • python bootcamp 2021
datai analytics