Hi guys this is Baljit and here is bytexl python impact question and answers which is hacked by TheBaljitSingh





  • What would be the output of the following snippet**\n\n```python\nif __name__==\"__main__\":\nyear = 2024\nevent =\"dhoom\"\nprint(f'Results of the {year} {event}') \n```\n
    • Ans - Results of the 2024 dhoom

  • What will be the output of the following snippet**\n\n\n```python\ns=\"hello\"\ns[0]='d'\nprint(s) \n```\n
    • Type Error\nStrings are immutable


  • What will be the output of the following**\n\n```python\ns=\"Hello\"\nprint(s.replace(\"Hello\",\"help\"))\nprint(s) \n```\n
    • help\nHello

  • What will be the output of following** \r\n\r\n```python\r\ns=\"welcome\"\r\nprint(s[:6]+'coder') \r\n```\r\n
    • welcomcoder

  • What will be the output of the following**\n\n```python\nfname=\"Python\"\nlname=\"Programming\"\nprint(\"fname:{},lname:{}\".format(lname,fname))\n```\n"
    • fname:Programming,lname:Python


  • What would be the output of the following line**\n```python\nprint(\"%d %s costs $%.2f\" %(6,Apples,4.65)\n
    • 6 Apples costs $4.65

  • What will be the output of the following snippet**\r\n\r\n```python\r\ntable = {'Sam': 4127, 'sundar': 4098, 'satya': 7678}\r\nfor name, phone in table.items():\r\n  print(f'{name:10} ==> {phone:10d}') \r\n```\r\
    • Sam        ==>       4127\nsundar     ==>       4098\nsatya      ==>       7678


  • What will be the output of the following**\n\n```python\nprint(\"this\\tis a \\nregular\\tstring\")\nprint(r\"this\\t is a \\n rawstring\") \n```\n
    • this        is a \nregular        string\nthis\\t is a \\n rawstring


  • What will be the output of the following**\n\n```python\ns=\"HeLlO\"\nprint(s.swapcase())\nprint(s) \n```\n
    • hElLo\r\nHeLlO

  • What will be the output of following**\n```python\ns=\"HeLlO\"\nprint(s*3)\n
    • HeLlOHeLlOHeLlO

       

for any type of help contact me on Linkdin

Thanks and Welcome


Post a Comment

Thanks for Your Comment. Ek Aur Kar Do

Previous Post Next Post