Hướng dẫn python coding problems - vấn đề mã hóa python

Chứng nhận Python là kỹ năng được tìm kiếm nhiều nhất trong lĩnh vực lập trình. Trong blog câu hỏi phỏng vấn Python này, tôi sẽ giới thiệu cho bạn những câu hỏi thường gặp nhất trong các cuộc phỏng vấn Python cho năm 2022. Chúng tôi có hơn 100 câu hỏi về cơ bản lập trình Python sẽ giúp bạn có các cấp độ chuyên môn khác nhau để gặt hái lợi ích tối đa từ blog của chúng tôi . is the most sought-after skill in the programming domain. In this Python Interview Questions blog, I will introduce you to the most frequently asked questions in Python interviews for the year 2022. We have 100+ questions on Python Programming basics which will help you with different expertise levels to reap the maximum benefit from our blog. is the most sought-after skill in the programming domain. In this Python Interview Questions blog, I will introduce you to the most frequently asked questions in Python interviews for the year 2022. We have 100+ questions on Python Programming basics which will help you with different expertise levels to reap the maximum benefit from our blog. is the most sought-after skill in the programming domain. In this Python Interview Questions blog, I will introduce you to the most frequently asked questions in Python interviews for the year 2022. We have 100+ questions on Python Programming basics which will help you with different expertise levels to reap the maximum benefit from our blog.

Show

Nội dung chính ShowShow

  • Câu hỏi và trả lời phỏng vấn Python 2022 | Đào tạo Python | Edureka
  • Câu hỏi phỏng vấn Python cơ bản cho Freshers
  • Q1. Sự khác biệt giữa danh sách và bộ dữ liệu trong Python là gì?
  • Q2. Các tính năng chính của Python là gì?
  • Q3. Python là loại ngôn ngữ nào? Lập trình hay kịch bản?
  • Q4.Python một ngôn ngữ được giải thích. Giải thích.
  • Q5. PEP 8 là gì?
  • Loại Generics Generics trong các bộ sưu tập tiêu chuẩn
  • Các mô -đun cải tiến như AST, Asyncio, v.v.
  • Tối ưu hóa như thành ngữ được tối ưu hóa để gán, xử lý tín hiệu, python được tối ưu hóa được xây dựng, v.v.
  • Q17. Bộ nhớ được quản lý như thế nào trong Python?
  • Q18. Không gian tên trong Python là gì?
  • Q19. Pythonpath là gì?
  • Q20. Các mô -đun Python là gì? Tên một số mô-đun tích hợp thường được sử dụng trong Python?
  • Q21. Các biến cục bộ và các biến toàn cầu trong Python là gì?
  • Q22. Trường hợp Python có nhạy cảm không?
  • Câu 23. Chuyển đổi loại trong Python là gì?
  • Q25. Có cần thụt vào Python không?
  • Q26. Sự khác biệt giữa các mảng Python và danh sách là gì?
  • Q27. Các chức năng trong Python là gì?
  • Q28. __init__ là gì?
  • Q29. Hàm Lambda là gì?
  • Q30. Bản thân trong Python là gì?
  • Q31. Làm thế nào để phá vỡ, tiếp tục và vượt qua công việc? How does break, continue and pass work?
  • Q32. [::-1} làm gì?What does [::-1} do?
  • Q33. Làm thế nào bạn có thể chọn ngẫu nhiên các mục của một danh sách tại chỗ trong Python?
  • Q34. Trình lặp Python là gì?
  • Q35. Làm thế nào bạn có thể tạo ra các số ngẫu nhiên trong Python?
  • Q36. Sự khác biệt giữa phạm vi & xrange là gì?
  • Q37. Làm thế nào để bạn viết bình luận trong Python?
  • Q38. Pickling và Unbickling là gì?
  • Q39. Các máy phát điện trong Python là gì?
  • Q40. Làm thế nào bạn sẽ viết hoa chữ cái đầu tiên của chuỗi?
  • Q41. Làm thế nào bạn sẽ chuyển đổi một chuỗi thành tất cả các chữ thường?
  • Q42. Làm thế nào để nhận xét nhiều dòng trong Python?
  • Câu 43. Docstrings trong Python là gì?
  • Q44. Mục đích của ‘là,’ không phải là người vận hành và trong các nhà khai thác?
  • Q45. Việc sử dụng hàm trợ giúp () và dir () trong Python là gì?
  • Q46. Bất cứ khi nào Python thoát ra, tại sao tất cả các bộ nhớ bị phân bổ?
  • Q47. Từ điển trong Python là gì?
  • Q48. Làm thế nào các toán tử ternary có thể được sử dụng trong Python? How can the ternary operators be used in python?
  • Q49. Điều này có nghĩa là gì: *args, ** kwargs? Và tại sao chúng ta sẽ sử dụng nó?
  • Q50. Len () làm gì?
  • Q51. Giải thích Split (), Sub (), Subn () của mô -đun RE RE trong Python.
  • Q52. Các chỉ mục tiêu cực là gì và tại sao chúng được sử dụng?What are negative indexes and why are they used?
  • Q53. & NBSP; Gói Python là gì? What are Python packages?
  • Q54. Làm thế nào các tệp có thể bị xóa trong Python?
  • Q55. Các loại python tích hợp là gì?
  • Q56. Những lợi thế nào mà các mảng numpy cung cấp so với danh sách python (lồng nhau)?
  • Q57. Làm thế nào để thêm các giá trị vào một mảng Python? How to add values to a python array?
  • Q58. Làm thế nào để loại bỏ các giá trị vào một mảng python?
  • Câu 59.does Python có khái niệm rất tiếc? Does Python have OOps concepts?
  • Q60. Sự khác biệt giữa bản sao sâu và nông là gì?
  • Q61. Làm thế nào là đa luồng đạt được trong Python?
  • Q62. Quá trình biên dịch và liên kết trong Python là gì? What is the process of compilation and linking in python?
  • Q63. Thư viện Python là gì? Kể tên một vài trong số họ.What are Python libraries? Name a few of them.
  • Q64. & Nbsp; được chia cho cái gì được sử dụng cho? What is split used for?
  • Rất tiếc, câu hỏi phỏng vấn PythonPython Interview Questions
  • Q66. Giải thích kế thừa trong Python với một ví dụ.
  • Q67. Làm thế nào các lớp được tạo ra trong Python? & NBSP;
  • Q68. Khỉ vá ở Python là gì?What is monkey patching in Python?
  • Q69. Python có hỗ trợ nhiều kế thừa không?
  • Q70. Đa hình trong Python là gì?. What is Polymorphism in Python?
  • Q71. Xác định đóng gói trong Python?
  • Q72. Làm thế nào để bạn thực hiện trừu tượng dữ liệu trong Python?
  • Q73.does Python sử dụng các nhà xác định truy cập?
  • Q74. Làm thế nào để tạo một lớp trống trong Python? & NBSP;
  • Q75. Một đối tượng () làm gì?
  • Các chương trình Python cơ bản - Câu hỏi phỏng vấn Python
  • Q76. Viết một chương trình trong Python để thực hiện thuật toán sắp xếp bong bóng.
  • Q77. Viết một chương trình bằng Python để sản xuất Tam giác Star.
  • Q78. Viết một chương trình để sản xuất loạt Fibonacci trong Python.
  • Q79. Viết một chương trình bằng Python để kiểm tra xem một số là số nguyên tố.
  • Q80. Viết một chương trình bằng Python để kiểm tra xem một chuỗi có phải là một palindrom không.
  • Q81. Viết một lớp lót sẽ đếm số lượng chữ in hoa trong một tệp. Mã của bạn sẽ hoạt động ngay cả khi tệp quá lớn để phù hợp với bộ nhớ.
  • Q82. Viết một thuật toán sắp xếp cho một bộ dữ liệu số trong Python.
  • Q83. Nhìn vào mã dưới đây, hãy viết ra các giá trị cuối cùng của A0, A1, AN AN.
  • Thư viện Python - Câu hỏi phỏng vấn Python
  • Q84. Giải thích bình là gì và lợi ích của nó?
  • Q85. Django có tốt hơn bình không?
  • Q86. Đề cập đến sự khác biệt giữa Django, kim tự tháp và bình.
  • Q87. Thảo luận về kiến ​​trúc Django.. Discuss Django architecture.
  • Q88. Giải thích cách bạn có thể thiết lập cơ sở dữ liệu trong Django.
  • Q89. Cho một ví dụ làm thế nào bạn có thể viết một chế độ xem trong Django?
  • Q90. Đề cập đến những gì các mẫu Django bao gồm.
  • Q91. Giải thích việc sử dụng phiên trong khung Django?
  • Quét web - Câu hỏi phỏng vấn Python
  • Q93. Làm thế nào để lưu một hình ảnh cục bộ bằng Python có địa chỉ URL mà tôi đã biết?
  • Q94. Làm thế nào bạn có thể nhận được tuổi bộ nhớ cache của Google của bất kỳ URL hoặc trang web nào?
  • a = lambda x,y : x+y print(a(5, 6)) 1Q95. Bạn được yêu cầu loại bỏ dữ liệu từ trang 250 phim Top IMDB. Nó chỉ nên có tên phim, năm và xếp hạng.Q95. You are required to scrap data from IMDb top 250 movies page. It should only have fields movie name, year, and rating.
  • Phân tích dữ liệu - Câu hỏi phỏng vấn Python
  • Q96. Chức năng bản đồ trong Python là gì?
  • Q97. Python numpy có tốt hơn danh sách không?
  • Q98. Làm thế nào để có được các chỉ số của n giá trị tối đa trong một mảng numpy?
  • Q99. Làm thế nào để bạn tính toán phần trăm với python/ numpy?
  • Q100. Sự khác biệt giữa Numpy và Scipy là gì?
  • Q101. Làm thế nào để bạn thực hiện các lô/trực quan hóa 3D bằng Numpy/Scipy?
  • Câu hỏi trắc nghiệm (MCQ) - Câu hỏi phỏng vấn PythonPython Interview Questions
  • Q102. Phát biểu nào sau đây tạo ra một từ điển? (Nhiều câu trả lời đúng có thể)
  • a) d = {} b) d = {Hồi John,: 40, Hồi Peter, 45} c) d = {40: Hồi John, 45: , 45: b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) d = (40:”john”, 45:”50”)
  • Q103. Cái nào trong số đó là phân chia sàn?
  • a) / b) // c) % d) không có ai trong số những người được đề cập b) // c) % d) None of the mentioned
  • Q104. Độ dài tối đa có thể của một định danh là gì?
  • Q105. Tại sao các tên biến cục bộ bắt đầu với một dấu gạch dưới không được khuyến khích?
  • Q106. Điều nào sau đây là một tuyên bố không hợp lệ?
  • Q107. Đầu ra của những điều sau đây là gì?
  • a) một số người đã xảy ra b) someError has not occured c) invalid code d) none of the above
  • Q108. Giả sử list1 là [2, 33, 222, 14, 25], list1 [-1] là gì?
  • Q109. Để mở tệp C: điểm.txt để viết, chúng tôi sử dụng
  • Q110. Đầu ra của những điều sau đây là gì?
  • a) TrueB) falsec) không) lỗi b) False c) None d) Error
  • Q111. Khi nào thì phần khác của Try-Except-Else sẽ được thực thi?
  • a) luôn luôn) khi xảy ra ngoại lệ) khi không xảy ra ngoại lệ) khi xảy ra ngoại lệ b) when an exception occurs c) when no exception occurs d) when an exception occurs into except block
  • Tôi có thể bẻ khóa cuộc phỏng vấn mã hóa với Python không?
  • Làm cách nào để thực hành phỏng vấn lập trình Python?

Nội dung chính ShowShowShow

  • Câu hỏi và trả lời phỏng vấn Python 2022 | Đào tạo Python | Edureka
  • Câu hỏi phỏng vấn Python cơ bản cho Freshers
  • Q1. Sự khác biệt giữa danh sách và bộ dữ liệu trong Python là gì?
  • Q2. Các tính năng chính của Python là gì?
  • Q3. Python là loại ngôn ngữ nào? Lập trình hay kịch bản?
  • Q4.Python một ngôn ngữ được giải thích. Giải thích.
  • Q5. PEP 8 là gì?
  • Loại Generics Generics trong các bộ sưu tập tiêu chuẩn
  • Các mô -đun cải tiến như AST, Asyncio, v.v.
  • Tối ưu hóa như thành ngữ được tối ưu hóa để gán, xử lý tín hiệu, python được tối ưu hóa được xây dựng, v.v.
  • Q17. Bộ nhớ được quản lý như thế nào trong Python?
  • Q18. Không gian tên trong Python là gì?
  • Q19. Pythonpath là gì?
  • Q20. Các mô -đun Python là gì? Tên một số mô-đun tích hợp thường được sử dụng trong Python?
  • Q21. Các biến cục bộ và các biến toàn cầu trong Python là gì?
  • Q22. Trường hợp Python có nhạy cảm không?
  • Câu 23. Chuyển đổi loại trong Python là gì?
  • Q25. Có cần thụt vào Python không?
  • Q26. Sự khác biệt giữa các mảng Python và danh sách là gì?
  • Q27. Các chức năng trong Python là gì?
  • Q28. __init__ là gì?
  • Q29. Hàm Lambda là gì?
  • Q30. Bản thân trong Python là gì?
  • Q31. Làm thế nào để phá vỡ, tiếp tục và vượt qua công việc? How does break, continue and pass work?
  • Q32. [::-1} làm gì?What does [::-1} do?
  • Q33. Làm thế nào bạn có thể chọn ngẫu nhiên các mục của một danh sách tại chỗ trong Python?
  • Q34. Trình lặp Python là gì?
  • Q35. Làm thế nào bạn có thể tạo ra các số ngẫu nhiên trong Python?
  • Q36. Sự khác biệt giữa phạm vi & xrange là gì?
  • Q37. Làm thế nào để bạn viết bình luận trong Python?
  • Q38. Pickling và Unbickling là gì?
  • Q39. Các máy phát điện trong Python là gì?
  • Q40. Làm thế nào bạn sẽ viết hoa chữ cái đầu tiên của chuỗi?
  • Q41. Làm thế nào bạn sẽ chuyển đổi một chuỗi thành tất cả các chữ thường?
  • Q42. Làm thế nào để nhận xét nhiều dòng trong Python?
  • Câu 43. Docstrings trong Python là gì?
  • Q44. Mục đích của ‘là,’ không phải là người vận hành và trong các nhà khai thác?
  • Q45. Việc sử dụng hàm trợ giúp () và dir () trong Python là gì?
  • Q46. Bất cứ khi nào Python thoát ra, tại sao tất cả các bộ nhớ bị phân bổ?
  • Q47. Từ điển trong Python là gì?
  • Q48. Làm thế nào các toán tử ternary có thể được sử dụng trong Python? How can the ternary operators be used in python?
  • Q49. Điều này có nghĩa là gì: *args, ** kwargs? Và tại sao chúng ta sẽ sử dụng nó?
  • Q50. Len () làm gì?
  • Q51. Giải thích Split (), Sub (), Subn () của mô -đun RE RE trong Python.
  • Q52. Các chỉ mục tiêu cực là gì và tại sao chúng được sử dụng?What are negative indexes and why are they used?
  • Q53. & NBSP; Gói Python là gì? What are Python packages?
  • Q54. Làm thế nào các tệp có thể bị xóa trong Python?
  • Q55. Các loại python tích hợp là gì?
  • Q56. Những lợi thế nào mà các mảng numpy cung cấp so với danh sách python (lồng nhau)?
  • Q57. Làm thế nào để thêm các giá trị vào một mảng Python? How to add values to a python array?
  • Q58. Làm thế nào để loại bỏ các giá trị vào một mảng python?
  • Câu 59.does Python có khái niệm rất tiếc? Does Python have OOps concepts?
  • Q60. Sự khác biệt giữa bản sao sâu và nông là gì?
  • Q61. Làm thế nào là đa luồng đạt được trong Python?
  • Q62. Quá trình biên dịch và liên kết trong Python là gì? What is the process of compilation and linking in python?
  • Q63. Thư viện Python là gì? Kể tên một vài trong số họ.What are Python libraries? Name a few of them.
  • Q64. & Nbsp; được chia cho cái gì được sử dụng cho? What is split used for?
  • Rất tiếc, câu hỏi phỏng vấn PythonPython Interview Questions
  • Q66. Giải thích kế thừa trong Python với một ví dụ.
  • Q67. Làm thế nào các lớp được tạo ra trong Python? & NBSP;
  • Q68. Khỉ vá ở Python là gì?What is monkey patching in Python?
  • Q69. Python có hỗ trợ nhiều kế thừa không?
  • Q70. Đa hình trong Python là gì?. What is Polymorphism in Python?
  • Q71. Xác định đóng gói trong Python?
  • Q72. Làm thế nào để bạn thực hiện trừu tượng dữ liệu trong Python?
  • Q73.does Python sử dụng các nhà xác định truy cập?
  • Q74. Làm thế nào để tạo một lớp trống trong Python? & NBSP;
  • Q75. Một đối tượng () làm gì?
  • Các chương trình Python cơ bản - Câu hỏi phỏng vấn Python
  • Q76. Viết một chương trình trong Python để thực hiện thuật toán sắp xếp bong bóng.
  • Q77. Viết một chương trình bằng Python để sản xuất Tam giác Star.
  • Q78. Viết một chương trình để sản xuất loạt Fibonacci trong Python.
  • Q79. Viết một chương trình bằng Python để kiểm tra xem một số là số nguyên tố.
  • Q80. Viết một chương trình bằng Python để kiểm tra xem một chuỗi có phải là một palindrom không.
  • Q81. Viết một lớp lót sẽ đếm số lượng chữ in hoa trong một tệp. Mã của bạn sẽ hoạt động ngay cả khi tệp quá lớn để phù hợp với bộ nhớ.
  • Q82. Viết một thuật toán sắp xếp cho một bộ dữ liệu số trong Python.
  • Q83. Nhìn vào mã dưới đây, hãy viết ra các giá trị cuối cùng của A0, A1, AN AN.
  • Thư viện Python - Câu hỏi phỏng vấn Python
  • Q84. Giải thích bình là gì và lợi ích của nó?
  • Q85. Django có tốt hơn bình không?
  • Q86. Đề cập đến sự khác biệt giữa Django, kim tự tháp và bình.
  • Q87. Thảo luận về kiến ​​trúc Django.. Discuss Django architecture.
  • Q88. Giải thích cách bạn có thể thiết lập cơ sở dữ liệu trong Django.
  • Q89. Cho một ví dụ làm thế nào bạn có thể viết một chế độ xem trong Django?
  • Q90. Đề cập đến những gì các mẫu Django bao gồm.
  • Q91. Giải thích việc sử dụng phiên trong khung Django?
  • Quét web - Câu hỏi phỏng vấn Python
  • Q93. Làm thế nào để lưu một hình ảnh cục bộ bằng Python có địa chỉ URL mà tôi đã biết?
  • Q94. Làm thế nào bạn có thể nhận được tuổi bộ nhớ cache của Google của bất kỳ URL hoặc trang web nào?
  • a = lambda x,y : x+y print(a(5, 6)) 1Q95. Bạn được yêu cầu loại bỏ dữ liệu từ trang 250 phim Top IMDB. Nó chỉ nên có tên phim, năm và xếp hạng.Q95. You are required to scrap data from IMDb top 250 movies page. It should only have fields movie name, year, and rating.
  • Phân tích dữ liệu - Câu hỏi phỏng vấn Python
  • Q96. Chức năng bản đồ trong Python là gì?
  • Q97. Python numpy có tốt hơn danh sách không?
  • Q98. Làm thế nào để có được các chỉ số của n giá trị tối đa trong một mảng numpy?
  • Q99. Làm thế nào để bạn tính toán phần trăm với python/ numpy?
  • Q100. Sự khác biệt giữa Numpy và Scipy là gì?
  • Q101. Làm thế nào để bạn thực hiện các lô/trực quan hóa 3D bằng Numpy/Scipy?
  • Câu hỏi trắc nghiệm (MCQ) - Câu hỏi phỏng vấn PythonPython Interview Questions
  • Q102. Phát biểu nào sau đây tạo ra một từ điển? (Nhiều câu trả lời đúng có thể)
  • a) d = {} b) d = {Hồi John,: 40, Hồi Peter, 45} c) d = {40: Hồi John, 45: , 45: b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) d = (40:”john”, 45:”50”)
  • Q103. Cái nào trong số đó là phân chia sàn?
  • a) / b) // c) % d) không có ai trong số những người được đề cập b) // c) % d) None of the mentioned
  • Q104. Độ dài tối đa có thể của một định danh là gì?
  • Q105. Tại sao các tên biến cục bộ bắt đầu với một dấu gạch dưới không được khuyến khích?
  • Q106. Điều nào sau đây là một tuyên bố không hợp lệ?
  • Q107. Đầu ra của những điều sau đây là gì?
  • a) một số người đã xảy ra b) someError has not occured c) invalid code d) none of the above
  • Q108. Giả sử list1 là [2, 33, 222, 14, 25], list1 [-1] là gì?
  • Q109. Để mở tệp C: điểm.txt để viết, chúng tôi sử dụng
  • Q110. Đầu ra của những điều sau đây là gì?
  • a) TrueB) falsec) không) lỗi b) False c) None d) Error
  • Q111. Khi nào thì phần khác của Try-Except-Else sẽ được thực thi?
  • a) luôn luôn) khi xảy ra ngoại lệ) khi không xảy ra ngoại lệ) khi xảy ra ngoại lệ b) when an exception occurs c) when no exception occurs d) when an exception occurs into except block
  • Tôi có thể bẻ khóa cuộc phỏng vấn mã hóa với Python không?
  • Làm cách nào để thực hành phỏng vấn lập trình Python?

Câu hỏi và trả lời phỏng vấn Python 2022 | Đào tạo Python | Edureka

Nếu bạn có những nghi ngờ khác liên quan đến Python hoặc về blog Câu hỏi phỏng vấn Python này, vui lòng đăng chúng trong diễn đàn QNA của chúng tôi. Nhóm chuyên gia của chúng tôi sẽ sớm trở lại với bạn.QnA Forum. Our expert team will get back to you at the earliest.QnA Forum. Our expert team will get back to you at the earliest.

Trước tiên chúng ta bắt đầu với một số câu hỏi phỏng vấn Python cơ bản.

Câu hỏi phỏng vấn Python cơ bản cho Freshers

Q1. Sự khác biệt giữa danh sách và bộ dữ liệu trong Python là gì?

Danh sách vs Tuples

DANH SÁCH Bộ dữ liệu
Danh sách có thể thay đổi tức là chúng có thể được chỉnh sửa. Bộ dữ liệu là bất biến (Tuples là danh sách có thể được chỉnh sửa).
Danh sách chậm hơn bộ dữ liệu. Tuples nhanh hơn danh sách.
Cú pháp: list_1 = [10, ‘Chelsea, 20] Cú pháp: TUP_1 = (10, ‘Chelsea, 20)

Q2. Các tính năng chính của Python là gì?

  • Python là một ngôn ngữ được giải thích. Điều đó có nghĩa là, không giống như các ngôn ngữ như C và các biến thể của nó, Python không cần phải được biên dịch trước khi nó được chạy. Các ngôn ngữ được giải thích khác bao gồm PHP và Ruby.interpreted language. That means that, unlike languages like C and its variants, Python does not need to be compiled before it is run. Other interpreted languages include PHP and Ruby.interpreted language. That means that, unlike languages like C and its variants, Python does not need to be compiled before it is run. Other interpreted languages include PHP and Ruby.
  • Python được gõ linh hoạt, điều này có nghĩa là bạn không cần phải nêu các loại biến khi bạn khai báo chúng hoặc bất cứ điều gì tương tự. Bạn có thể làm những việc như ________ 56 & nbsp; và sau đó
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    7 mà không có lỗidynamically typed, this means that you don’t need to state the types of variables when you declare them or anything like that. You can do things like
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    6 and then
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    7 without errordynamically typed, this means that you don’t need to state the types of variables when you declare them or anything like that. You can do things like
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    6 and then
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    7 without error
  • Python rất phù hợp với lập trình định hướng đối tượng ở chỗ nó cho phép định nghĩa các lớp cùng với thành phần và kế thừa. Python không có các nhà xác định truy cập (như C ++, s
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    8,
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    9).object orientated programming in that it allows the definition of classes along with composition and inheritance. Python does not have access specifiers (like C++’s
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    8,
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    9).object orientated programming in that it allows the definition of classes along with composition and inheritance. Python does not have access specifiers (like C++’s
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    8,
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    9).
  • Trong Python, các chức năng là các đối tượng hạng nhất. Điều này có nghĩa là chúng có thể được gán cho các biến, được trả về từ các chức năng khác và được chuyển vào các chức năng. Các lớp học cũng là đối tượng hạng nhấtfunctions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions. Classes are also first class objectsfunctions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions. Classes are also first class objectsfunctions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions. Classes are also first class objects
  • Viết mã Python nhanh nhưng chạy nó thường chậm hơn các ngôn ngữ được biên dịch. May mắn thay, Python cho phép bao gồm các tiện ích mở rộng dựa trên C để các tắc nghẽn có thể được tối ưu hóa và thường là. Gói Numpy là một ví dụ điển hình cho điều này, nó thực sự khá nhanh chóng vì rất nhiều thứ mà nó thực sự được thực hiện bởi Python but running it is often slower than compiled languages. Fortunately,Python allows the inclusion of C-based extensions so bottlenecks can be optimized away and often are. The numpy package is a good example of this, it’s really quite quick because a lot of the number-crunching it does isn’t actually done by Python but running it is often slower than compiled languages. Fortunately,Python allows the inclusion of C-based extensions so bottlenecks can be optimized away and often are. The numpy package is a good example of this, it’s really quite quick because a lot of the number-crunching it does isn’t actually done by Python but running it is often slower than compiled languages. Fortunately,Python allows the inclusion of C-based extensions so bottlenecks can be optimized away and often are. The numpy package is a good example of this, it’s really quite quick because a lot of the number-crunching it does isn’t actually done by Python
  • Python tìm thấy việc sử dụng trong nhiều lĩnh vực - ứng dụng web, tự động hóa, mô hình khoa học, ứng dụng dữ liệu lớn và nhiều thứ khác. Nó cũng thường được sử dụng làm mã keo dán của Google để có được các ngôn ngữ và thành phần khác để chơi đẹp.use in many spheres – web applications, automation, scientific modeling, big data applications and many more. It’s also often used as “glue” code to get other languages and components to play nice.use in many spheres – web applications, automation, scientific modeling, big data applications and many more. It’s also often used as “glue” code to get other languages and components to play nice.use in many spheres – web applications, automation, scientific modeling, big data applications and many more. It’s also often used as “glue” code to get other languages and components to play nice.

Q3. Python là loại ngôn ngữ nào? Lập trình hay kịch bản?

Trả lời: Python có khả năng viết kịch bản, nhưng theo nghĩa chung, nó được coi là một ngôn ngữ lập trình đa năng. Để biết thêm về kịch bản, bạn có thể tham khảo hướng dẫn kịch bản Python.Python is capable of scripting, but in general sense, it is considered as a general-purpose programming language. To know more about Scripting, you can refer to the Python Scripting Tutorial.Python is capable of scripting, but in general sense, it is considered as a general-purpose programming language. To know more about Scripting, you can refer to the Python Scripting Tutorial.Python is capable of scripting, but in general sense, it is considered as a general-purpose programming language. To know more about Scripting, you can refer to the Python Scripting Tutorial.

Q4.Python một ngôn ngữ được giải thích. Giải thích.

Trả lời: Một ngôn ngữ được giải thích là bất kỳ ngôn ngữ lập trình nào không có trong mã cấp máy trước thời gian chạy. Do đó, Python là một ngôn ngữ được giải thích.An interpreted language is any programming language which is not in machine-level code before runtime. Therefore, Python is an interpreted language.An interpreted language is any programming language which is not in machine-level code before runtime. Therefore, Python is an interpreted language.An interpreted language is any programming language which is not in machine-level code before runtime. Therefore, Python is an interpreted language.

Q5. PEP 8 là gì?

ANS: PEP là viết tắt của đề xuất tăng cường Python. Đây là một tập hợp các quy tắc chỉ định cách định dạng mã python cho khả năng đọc tối đa.PEP stands for Python Enhancement Proposal. It is a set of rules that specify how to format Python code for maximum readability.PEP stands for Python Enhancement Proposal. It is a set of rules that specify how to format Python code for maximum readability.PEP stands for Python Enhancement Proposal. It is a set of rules that specify how to format Python code for maximum readability.

Câu 6. Lợi ích của việc sử dụng Python là gì?

Trả lời: Những lợi ích của việc sử dụng Python là-The benefits of using python are-The benefits of using python are-The benefits of using python are-

    1. Dễ dàng sử dụng của Python là một ngôn ngữ lập trình cấp cao, dễ sử dụng, đọc, viết và học hỏi.– Python is a high-level programming language that is easy to use, read, write and learn.– Python is a high-level programming language that is easy to use, read, write and learn.– Python is a high-level programming language that is easy to use, read, write and learn.
    2. Ngôn ngữ được giải thích Kể từ khi Python được giải thích ngôn ngữ, nó thực thi từng dòng mã và dừng nếu xảy ra lỗi trong bất kỳ dòng nào.– Since python is interpreted language, it executes the code line by line and stops if an error occurs in any line.– Since python is interpreted language, it executes the code line by line and stops if an error occurs in any line.– Since python is interpreted language, it executes the code line by line and stops if an error occurs in any line.
    3. Được gõ một cách tự động, nhà phát triển không gán các loại dữ liệu cho các biến tại thời điểm mã hóa. Nó tự động được gán trong khi thực hiện.– the developer does not assign data types to variables at the time of coding. It automatically gets assigned during execution.– the developer does not assign data types to variables at the time of coding. It automatically gets assigned during execution.
    4. Python miễn phí và nguồn mở miễn phí để sử dụng và phân phối. Nó là nguồn mở.– Python is free to use and distribute. It is open source.– Python is free to use and distribute. It is open source.
    5. Hỗ trợ rộng rãi cho các thư viện Python Python có các thư viện rộng lớn chứa hầu hết mọi chức năng cần thiết. Nó cũng cung cấp thêm cơ sở để nhập các gói khác bằng Trình quản lý gói Python (PIP).– Python has vast libraries that contain almost any function needed. It also further provides the facility to import other packages using Python Package Manager(pip).– Python has vast libraries that contain almost any function needed. It also further provides the facility to import other packages using Python Package Manager(pip).
    6. Các chương trình Python di động có thể chạy trên bất kỳ nền tảng nào mà không cần bất kỳ thay đổi nào.– Python programs can run on any platform without requiring any change.– Python programs can run on any platform without requiring any change.
    7. Các cấu trúc dữ liệu được sử dụng trong Python thân thiện với người dùng.
    8. Nó cung cấp nhiều chức năng hơn với ít mã hóa hơn.

Tìm hiểu đào tạo Python của chúng tôi ở các thành phố/quốc gia hàng đầu

Ấn Độ Hoa Kỳ Các thành phố/quốc gia khác
Bangalore Newyork Vương quốc Anh
Hyderabad Chicago London
Delhi Atlanta Canada
Chennai Houston Toronto
Mumbai Los Angeles Châu Úc
Pune Boston UAE
Kolkata Miami Dubai
Ahmedabad San Francisco Philippines

Q7. Không gian tên Python là gì?

Trả lời: Một không gian tên trong Python đề cập đến tên được gán cho từng đối tượng trong Python. Các đối tượng là các biến và hàm. Khi mỗi đối tượng được tạo, tên của nó cùng với không gian (địa chỉ của hàm bên ngoài trong đó đối tượng là), được tạo. Các không gian tên được duy trì trong Python giống như một từ điển trong đó chìa khóa là không gian tên và giá trị là địa chỉ của đối tượng. Có 4 loại không gian tên trong Python-A namespace in python refers to the name which is assigned to each object in python. The objects are variables and functions. As each object is created, its name along with space(the address of the outer function in which the object is), gets created. The namespaces are maintained in python like a dictionary where the key is the namespace and value is the address of the object. There 4 types of namespace in python-A namespace in python refers to the name which is assigned to each object in python. The objects are variables and functions. As each object is created, its name along with space(the address of the outer function in which the object is), gets created. The namespaces are maintained in python like a dictionary where the key is the namespace and value is the address of the object. There 4 types of namespace in python-

  1. Không gian tên tích hợp, các không gian tên này chứa tất cả các đối tượng tích hợp trong Python và có sẵn bất cứ khi nào Python đang chạy.– These namespaces contain all the built-in objects in python and are available whenever python is running.– These namespaces contain all the built-in objects in python and are available whenever python is running.
  2. Không gian tên toàn cầu, đây là những không gian tên cho tất cả các đối tượng được tạo ở cấp độ của chương trình chính.– These are namespaces for all the objects created at the level of the main program.– These are namespaces for all the objects created at the level of the main program.
  3. Bao quanh các không gian tên, các không gian tên này ở mức cao hơn hoặc hàm bên ngoài.– These namespaces are at the higher level or outer function.– These namespaces are at the higher level or outer function.
  4. Không gian tên cục bộ, các không gian tên này ở chức năng cục bộ hoặc bên trong.– These namespaces are at the local or inner function.– These namespaces are at the local or inner function.

Q8. Nhà trang trí trong Python là gì?

Trả lời: Các nhà trang trí được sử dụng để thêm một số mẫu thiết kế vào một chức năng mà không thay đổi cấu trúc của nó. Các nhà trang trí thường được xác định trước khi chức năng họ đang tăng cường. Để áp dụng một bộ trang trí, trước tiên chúng tôi xác định chức năng trang trí. Sau đó, chúng tôi viết hàm nó được áp dụng và chỉ cần thêm hàm trang trí trên chức năng mà nó phải được áp dụng. Đối với điều này, chúng tôi sử dụng ký hiệu @ trước khi trang trí.Decorators are used to add some design patterns to a function without changing its structure. Decorators generally are defined before the function they are enhancing. To apply a decorator we first define the decorator function. Then we write the function it is applied to and simply add the decorator function above the function it has to be applied to. For this, we use the @ symbol before the decorator.Decorators are used to add some design patterns to a function without changing its structure. Decorators generally are defined before the function they are enhancing. To apply a decorator we first define the decorator function. Then we write the function it is applied to and simply add the decorator function above the function it has to be applied to. For this, we use the @ symbol before the decorator.

Q9.

ANS: Từ điển và toàn bộ danh sách chỉ là một cách ngắn gọn khác để xác định từ điển và danh sách. Dictionary and list comprehensions are just another concise way to define dictionaries and lists. Dictionary and list comprehensions are just another concise way to define dictionaries and lists. Dictionary and list comprehensions are just another concise way to define dictionaries and lists.

Ví dụ về sự hiểu biết danh sách là-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
1

Mã trên tạo một danh sách dưới đây-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
2

Ví dụ về sự hiểu biết từ điển là-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
3

Mã trên tạo một danh sách dưới đây-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
0

Ví dụ về sự hiểu biết từ điển là-

Câu 10. Các loại dữ liệu tích hợp phổ biến trong Python là gì? The common built-in data types in python are- The common built-in data types in python are- The common built-in data types in python are-

Trả lời: Các loại dữ liệu tích hợp phổ biến trong Python là-– They include integers, floating-point numbers, and complex numbers. eg. – They include integers, floating-point numbers, and complex numbers. eg. – They include integers, floating-point numbers, and complex numbers. eg.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
10

Các số, chúng bao gồm số nguyên, số dấu phẩy động và số phức. ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
20– An ordered sequence of items is called a list. The elements of a list may belong to different data types. Eg. 0– An ordered sequence of items is called a list. The elements of a list may belong to different data types. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
110– An ordered sequence of items is called a list. The elements of a list may belong to different data types. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
11

Danh sách một chuỗi các mục được đặt hàng được gọi là một danh sách. Các yếu tố của một danh sách có thể thuộc về các loại dữ liệu khác nhau. Ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
21– It is also an ordered sequence of elements. Unlike lists , tuples are immutable, which means they can’t be changed. Eg. 1– It is also an ordered sequence of elements. Unlike lists , tuples are immutable, which means they can’t be changed. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
121– It is also an ordered sequence of elements. Unlike lists , tuples are immutable, which means they can’t be changed. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
12

Đây cũng là một chuỗi các yếu tố được đặt hàng. Không giống như danh sách, các bộ dữ liệu là bất biến, điều đó có nghĩa là chúng có thể được thay đổi. Ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
22– A sequence of characters is called a string. They are declared within single or double-quotes. Eg.2– A sequence of characters is called a string. They are declared within single or double-quotes. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
13,
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14, etc.2– A sequence of characters is called a string. They are declared within single or double-quotes. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
13,
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14, etc.

Chuỗi Chuỗi Một chuỗi các ký tự được gọi là một chuỗi. Chúng được tuyên bố trong các tài liệu đơn hoặc kép. Ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
23,
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14, v.v.– Sets are a collection of unique items that are not in order. Eg. 3,
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14, v.v.– Sets are a collection of unique items that are not in order. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
153,
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14, v.v.
– Sets are a collection of unique items that are not in order. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
15

Bộ tập hợp là một tập hợp các mục độc đáo không theo thứ tự. Ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
25– A dictionary stores values in key and value pairs where each value can be accessed through its key. The order of items is not important. Eg. 5– A dictionary stores values in key and value pairs where each value can be accessed through its key. The order of items is not important. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
16 5– A dictionary stores values in key and value pairs where each value can be accessed through its key. The order of items is not important. Eg.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
16

Từ điển Một từ điển lưu trữ các giá trị trong các cặp khóa và giá trị trong đó mỗi giá trị có thể được truy cập thông qua khóa của nó. Thứ tự của các mặt hàng không quan trọng. Ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
26– There are 2 boolean values- True and False.6– There are 2 boolean values- True and False.6– There are 2 boolean values- True and False.

Boolean, có 2 giá trị boolean- đúng và sai.

Q11. Sự khác biệt giữa các tệp .py và .pyc là gì? The .py files are the python source code files. While the .pyc files contain the bytecode of the python files. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time. The .py files are the python source code files. While the .pyc files contain the bytecode of the python files. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time. The .py files are the python source code files. While the .pyc files contain the bytecode of the python files. .pyc files are created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files which helps by saving time.

ANS: Các tệp .py là các tệp mã nguồn Python. Trong khi các tệp .pyc chứa mã byte của các tệp python. Các tệp .pyc được tạo khi mã được nhập từ một số nguồn khác. Trình thông dịch chuyển đổi các tệp .py nguồn thành các tệp .pyc giúp tiết kiệm thời gian.

Q12. Cắt lát ở Python là gì? Slicing is used to access parts of sequences like lists, tuples, and strings. The syntax of slicing is- Slicing is used to access parts of sequences like lists, tuples, and strings. The syntax of slicing is- Slicing is used to access parts of sequences like lists, tuples, and strings. The syntax of slicing is-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
17. The step can be omitted as well. When we write
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
18 this returns all the elements of the sequence from the start (inclusive) till the end-1 element. If the start or end element is negative i, it means the ith element from the end. The step indicates the jump or how many elements have to be skipped. Eg. if there is a list-
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
19. Then
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
80 will return elements starting from the last element till the third element by printing every second element.i.e.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
81.

Trả lời: Cắt được sử dụng để truy cập các phần của các chuỗi như danh sách, bộ dữ liệu và chuỗi. Cú pháp cắt lát là -____ ____ 67. Bước có thể được bỏ qua là tốt. Khi chúng tôi viết

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
28, điều này sẽ trả về tất cả các yếu tố của chuỗi từ đầu (bao gồm) cho đến phần tử End-1. Nếu phần tử bắt đầu hoặc kết thúc là âm i, nó có nghĩa là phần tử ith từ cuối. Bước cho biết bước nhảy hoặc có bao nhiêu yếu tố phải được bỏ qua. Ví dụ. Nếu có một danh sách-
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
19. Sau đó ____70 sẽ trả về các phần tử bắt đầu từ phần tử cuối cùng cho đến phần tử thứ ba bằng cách in mọi phần tử thứ hai.I.E.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
81.8, điều này sẽ trả về tất cả các yếu tố của chuỗi từ đầu (bao gồm) cho đến phần tử End-1. Nếu phần tử bắt đầu hoặc kết thúc là âm i, nó có nghĩa là phần tử ith từ cuối. Bước cho biết bước nhảy hoặc có bao nhiêu yếu tố phải được bỏ qua. Ví dụ. Nếu có một danh sách-
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
19. Sau đó ____70 sẽ trả về các phần tử bắt đầu từ phần tử cuối cùng cho đến phần tử thứ ba bằng cách in mọi phần tử thứ hai.I.E.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
81.8, điều này sẽ trả về tất cả các yếu tố của chuỗi từ đầu (bao gồm) cho đến phần tử End-1. Nếu phần tử bắt đầu hoặc kết thúc là âm i, nó có nghĩa là phần tử ith từ cuối. Bước cho biết bước nhảy hoặc có bao nhiêu yếu tố phải được bỏ qua. Ví dụ. Nếu có một danh sách-
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
19. Sau đó ____70 sẽ trả về các phần tử bắt đầu từ phần tử cuối cùng cho đến phần tử thứ ba bằng cách in mọi phần tử thứ hai.I.E.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
81.

Q13. Từ khóa trong Python là gì? Keywords in python are reserved words that have special meaning.They are generally used to define type of variables. Keywords cannot be used for variable or function names. There are following 33 keywords in python- Keywords in python are reserved words that have special meaning.They are generally used to define type of variables. Keywords cannot be used for variable or function names. There are following 33 keywords in python- Keywords in python are reserved words that have special meaning.They are generally used to define type of variables. Keywords cannot be used for variable or function names. There are following 33 keywords in python-

  • Trả lời: Từ khóa trong Python là những từ dành riêng có ý nghĩa đặc biệt. Chúng thường được sử dụng để xác định loại biến. Từ khóa không thể được sử dụng cho tên biến hoặc tên chức năng. Có 33 từ khóa trong Python-
  • Hoặc
  • Không
  • Nếu
  • Elif
  • Khác
  • Trong khi
  •  As
  • Phá vỡ
  • Def
  • Lambda
  • Đi qua
  • Trở về
  • ĐÚNG VẬY
  • Sai
  • Thử
  • Với
  • Khẳng định
  • Lớp
  • Tiếp tục
  • Del
  • Ngoại trừ
  • Cuối cùng
  • Từ
  • Toàn cầu
  • Nhập khẩu
  • Trong
  • Không có
  • Không thuộc địa
  • Nuôi

Năng suất

Q14 A literal in python source code represents a fixed value for primitive data types. There are 5 types of literals in python- A literal in python source code represents a fixed value for primitive data types. There are 5 types of literals in python- A literal in python source code represents a fixed value for primitive data types. There are 5 types of literals in python-

  1. Trả lời: Một theo nghĩa đen trong mã nguồn Python đại diện cho một giá trị cố định cho các loại dữ liệu nguyên thủy. Có 5 loại nghĩa đen trong Python-– A string literal is created by assigning some text enclosed in single or double quotes to a variable. To create multiline literals, assign the multiline text enclosed in triple quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    82– A string literal is created by assigning some text enclosed in single or double quotes to a variable. To create multiline literals, assign the multiline text enclosed in triple quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    82
    – A string literal is created by assigning some text enclosed in single or double quotes to a variable. To create multiline literals, assign the multiline text enclosed in triple quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    82
  2. Chuỗi nghĩa đen Một chuỗi theo nghĩa đen được tạo bằng cách gán một số văn bản được đặt trong các trích dẫn đơn hoặc đôi cho một biến. Để tạo ra nghĩa đen đa dòng, gán văn bản đa dòng được đặt trong ba trích dẫn. Ví dụ: ____________ 72– It is created by assigning a single character enclosed in double quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    83– It is created by assigning a single character enclosed in double quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    83
    – It is created by assigning a single character enclosed in double quotes. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    83
  3. Một ký tự theo nghĩa đen, nó được tạo bằng cách gán một ký tự duy nhất được đặt trong các trích dẫn kép. Ví dụ.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    83 include numeric values that can be either integer, floating point value, or a complex number. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    84 include numeric values that can be either integer, floating point value, or a complex number. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    84
     include numeric values that can be either integer, floating point value, or a complex number. Eg.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    84
  4. Chữ số & nbsp; bao gồm các giá trị số có thể là số nguyên, giá trị điểm nổi hoặc số phức. Ví dụ.
    import array as arr
    My_Array=arr.array('i',[1,2,3,4])
    My_list=[1,'abc',1.20]
    print(My_Array)
    print(My_list)
    
    84– These can be 2 values- either True or False.– These can be 2 values- either True or False.
    – These can be 2 values- either True or False.
  5. Boolean Ligsals Đây có thể là 2 giá trị- đúng hoặc sai.– These are of 4 types-– These are of 4 types-– These are of 4 types-

Bộ sưu tập theo nghĩa đen- Đây là 4 loại-

a) Danh sách Bộ sưu tập-EG.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
85

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; b) Tuple Biết chữ- ví dụ: ____ 76 76

c) Từ điển văn học- ví dụ .________ 77

d) Đặt nghĩa đen- ví dụ.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
88

6. Đặc biệt theo nghĩa đen- Python có 1 theo nghĩa đen đặc biệt Không được sử dụng để trả về một biến null.

Q15. Làm thế nào để kết hợp các khung dữ liệu trong gấu trúc? The dataframes in python can be combined in the following ways- The dataframes in python can be combined in the following ways- The dataframes in python can be combined in the following ways-

  1. Kết hợp chúng bằng cách xếp 2 khung dữ liệu theo chiều dọc.
  2. Kết hợp chúng bằng cách xếp 2 DataFrames theo chiều ngang.
  3. Kết hợp chúng trên một cột chung. Điều này được gọi là tham gia.

Hàm Concat () được sử dụng để kết hợp hai khung dữ liệu. Cú pháp của nó là-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
89.

DataFrames được nối với nhau trên một cột chung được gọi là khóa. Khi chúng tôi kết hợp tất cả các hàng trong DataFrame, đó là công đoàn và sự tham gia được sử dụng là tham gia bên ngoài. Trong khi, khi chúng ta kết hợp các hàng hoặc giao lộ phổ biến, sự tham gia được sử dụng là tham gia bên trong. Cú pháp của nó là-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
10

Q16. Các tính năng mới được thêm vào phiên bản Python 3.9.0.0 là gì?

Trả lời: Các tính năng mới trong phiên bản Python 3.9.0.0 là-The new features in Python 3.9.0.0 version are-The new features in Python 3.9.0.0 version are-The new features in Python 3.9.0.0 version are-

  • & nbsp; hàm từ điển mới hợp nhất (|) và cập nhật (| =)
  • Các phương thức chuỗi mới để xóa các tiền tố và hậu tố
  • Loại Generics Generics trong các bộ sưu tập tiêu chuẩn

  • Trình phân tích cú pháp mới dựa trên PEG chứ không phải LL1
  • Các mô -đun mới như ZoneInfo và Graphlib
  • Các mô -đun cải tiến như AST, Asyncio, v.v.

  • Tối ưu hóa như thành ngữ được tối ưu hóa để gán, xử lý tín hiệu, python được tối ưu hóa được xây dựng, v.v.

  • Các chức năng và các lệnh không dùng nữa như trình phân tích cú pháp không dùng nữa và mô -đun biểu tượng, các chức năng không dùng nữa, v.v.
  • Loại bỏ các phương pháp, chức năng, v.v.

Q17. Bộ nhớ được quản lý như thế nào trong Python?

Trả lời: Bộ nhớ được quản lý bằng Python theo những cách sau: Memory is managed in Python in the following ways: Memory is managed in Python in the following ways: Memory is managed in Python in the following ways:

  1. Quản lý bộ nhớ trong Python được quản lý bởi Python Private Heap Space. Tất cả các đối tượng Python và cấu trúc dữ liệu được đặt trong một đống riêng tư. Các lập trình viên không có quyền truy cập vào đống riêng tư này. Thay vào đó, thông dịch viên Python chăm sóc điều này.Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.
  2. Việc phân bổ không gian heap cho các đối tượng Python được thực hiện bởi Trình quản lý bộ nhớ Python. API cốt lõi cho phép truy cập vào một số công cụ để lập trình viên mã hóa.
  3. Python cũng có một bộ thu rác sẵn có, trong đó tái chế tất cả bộ nhớ không sử dụng và để nó có thể được cung cấp cho không gian đống.

Q18. Không gian tên trong Python là gì?

Trả lời: Một không gian tên là một hệ thống đặt tên được sử dụng để đảm bảo rằng tên là duy nhất để tránh đặt tên xung đột.A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.

Q19. Pythonpath là gì?

Trả lời: Đây là một biến môi trường được sử dụng khi nhập mô -đun. Bất cứ khi nào một mô -đun được nhập, Pythonpath cũng được tra cứu để kiểm tra sự hiện diện của các mô -đun nhập khẩu trong các thư mục khác nhau. Thông dịch viên sử dụng nó để xác định mô -đun nào để tải.It is an environment variable which is used when a module is imported. Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories. The interpreter uses it to determine which module to load.It is an environment variable which is used when a module is imported. Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories. The interpreter uses it to determine which module to load.It is an environment variable which is used when a module is imported. Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories. The interpreter uses it to determine which module to load.

Q20. Các mô -đun Python là gì? Tên một số mô-đun tích hợp thường được sử dụng trong Python?

ANS: Các mô -đun Python là các tệp chứa mã Python. Mã này có thể là các lớp chức năng hoặc biến. Mô -đun Python là một tệp .py chứa mã thực thi.Python modules are files containing Python code. This code can either be functions classes or variables. A Python module is a .py file containing executable code.Python modules are files containing Python code. This code can either be functions classes or variables. A Python module is a .py file containing executable code.Python modules are files containing Python code. This code can either be functions classes or variables. A Python module is a .py file containing executable code.

Một số mô-đun tích hợp thường được sử dụng là:

  • hệ điều hành
  • sys
  • môn Toán
  • ngẫu nhiên
  • Thời gian dữ liệu
  • Json

Q21. Các biến cục bộ và các biến toàn cầu trong Python là gì?

Biến toàn cầu:

Các biến được khai báo bên ngoài một hàm hoặc trong không gian toàn cầu được gọi là các biến toàn cầu. Các biến này có thể được truy cập bởi bất kỳ chức năng nào trong chương trình.

Các biến cục bộ:

Bất kỳ biến nào được khai báo bên trong một hàm được gọi là một biến cục bộ. Biến này có mặt trong không gian địa phương chứ không phải trong không gian toàn cầu.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
2

Output: 5555

Khi bạn cố gắng truy cập biến cục bộ bên ngoài hàm thêm (), nó sẽ gây ra lỗi.

Q22. Trường hợp Python có nhạy cảm không?

Trả lời: Có. Python là một ngôn ngữ nhạy cảm trường hợp.Yes. Python is a case sensitive language.Yes. Python is a case sensitive language.Yes. Python is a case sensitive language.

Câu 23. Chuyển đổi loại trong Python là gì?

Trả lời: Chuyển đổi loại đề cập đến việc chuyển đổi một loại dữ liệu sang loại dữ liệu khác.Type conversion refers to the conversion of one data type into another.Type conversion refers to the conversion of one data type into another.Type conversion refers to the conversion of one data type into another.

int () - Chuyển đổi bất kỳ loại dữ liệu nào thành loại số nguyên – converts any data type into integer type – converts any data type into integer type – converts any data type into integer type

float () - Chuyển đổi bất kỳ loại dữ liệu nào thành loại float – converts any data type into float type – converts any data type into float type – converts any data type into float type

Ord () - Chuyển đổi các ký tự thành số nguyên – converts characters into integer – converts characters into integer – converts characters into integer

hex () - chuyển đổi số nguyên thành thập lục phân) – converts integers to hexadecimal) – converts integers to hexadecimal) – converts integers to hexadecimal

OCT () - Chuyển đổi số nguyên thành Octal – converts integer to octal – converts integer to octal – converts integer to octal

Tuple () - Hàm này được sử dụng để & nbsp; chuyển đổi thành một tuple.This function is used to convert to a tuple.This function is used to convert to a tuple.This function is used to convert to a tuple.

Đặt () - Hàm này trả về & nbsp; loại sau khi chuyển đổi thành SET.This function returns the type after converting to set.This function returns the type after converting to set.This function returns the type after converting to set.

Danh sách () - & nbsp; Hàm này được sử dụng để chuyển đổi & nbsp; mọi loại dữ liệu thành loại danh sách.This function is used to convert any data type to a list type.This function is used to convert any data type to a list type.This function is used to convert any data type to a list type.

Dict () - & nbsp; Hàm này được sử dụng để chuyển đổi một bộ thứ tự (khóa, giá trị) thành từ điển.This function is used to convert a tuple of order (key, value) into a dictionary.This function is used to convert a tuple of order (key, value) into a dictionary.This function is used to convert a tuple of order (key, value) into a dictionary.

str () - & nbsp; được sử dụng để & nbsp; chuyển đổi số nguyên thành một chuỗi.Used to convert integer into a string.Used to convert integer into a string.Used to convert integer into a string.

phức tạp (thực, hình ảnh) - hàm này chuyển đổi số thực thành số phức (thực, hình ảnh). This function converts real numbers to complex(real,imag) number. This function converts real numbers to complex(real,imag) number. This function converts real numbers to complex(real,imag) number.

Q24. Làm thế nào để cài đặt Python trên Windows và đặt biến đường dẫn?

Trả lời: Để cài đặt Python trên Windows, hãy làm theo các bước dưới đây:To install Python on Windows, follow the below steps:To install Python on Windows, follow the below steps:To install Python on Windows, follow the below steps:

  • Cài đặt Python từ liên kết này: https://www.python.org/doads/
  • Sau đó, cài đặt nó trên PC của bạn. Tìm vị trí mà Python đã được cài đặt trên PC của bạn bằng lệnh sau trên dấu nhắc lệnh của bạn: CMD Python. & NBSP;
  • Sau đó chuyển đến cài đặt hệ thống nâng cao và thêm một biến mới và đặt tên nó là python_name và dán đường dẫn sao chép.
  • Tìm biến đường dẫn, chọn giá trị của nó và chọn ‘Chỉnh sửa.
  • Thêm một dấu chấm phẩy vào cuối giá trị nếu nó không có mặt và sau đó nhập %python_home %& nbsp;

Q25. Có cần thụt vào Python không?

ANS: thụt lề là cần thiết cho Python. Nó chỉ định một khối mã. Tất cả mã trong các vòng lặp, lớp, chức năng, vv được chỉ định trong một khối thụt lề. Nó thường được thực hiện bằng cách sử dụng bốn ký tự không gian. Nếu mã của bạn không nhất thiết phải thụt vào, nó sẽ không thực thi chính xác và cũng sẽ ném lỗi.Indentation is necessary for Python. It specifies a block of code. All code within loops, classes, functions, etc is specified within an indented block. It is usually done using four space characters. If your code is not indented necessarily, it will not execute accurately and will throw errors as well.Indentation is necessary for Python. It specifies a block of code. All code within loops, classes, functions, etc is specified within an indented block. It is usually done using four space characters. If your code is not indented necessarily, it will not execute accurately and will throw errors as well.Indentation is necessary for Python. It specifies a block of code. All code within loops, classes, functions, etc is specified within an indented block. It is usually done using four space characters. If your code is not indented necessarily, it will not execute accurately and will throw errors as well.

Q26. Sự khác biệt giữa các mảng Python và danh sách là gì?

ANS: Mảng và danh sách, trong Python, có cùng cách lưu trữ dữ liệu. Nhưng, các mảng chỉ có thể giữ một phần tử kiểu dữ liệu duy nhất trong khi danh sách có thể giữ bất kỳ yếu tố kiểu dữ liệu nào.Arrays and lists, in Python, have the same way of storing data. But, arrays can hold only a single data type elements whereas lists can hold any data type elements.Arrays and lists, in Python, have the same way of storing data. But, arrays can hold only a single data type elements whereas lists can hold any data type elements.Arrays and lists, in Python, have the same way of storing data. But, arrays can hold only a single data type elements whereas lists can hold any data type elements.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)

Output:

Mảng (‘I, [1, 2, 3, 4]) [1,‘ ABC, 1.2]

Q27. Các chức năng trong Python là gì?

Trả lời: Một hàm là một khối mã chỉ được thực thi khi nó được gọi. Để xác định hàm Python, từ khóa DEF được sử dụng.A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
1

Đầu ra: Xin chào, Chào mừng bạn đến với EdurekaHi, Welcome to EdurekaHi, Welcome to EdurekaHi, Welcome to Edureka

Q28. __init__ là gì?

ANS: __init__ là một phương pháp hoặc hàm tạo trong Python. Phương thức này được gọi tự động để phân bổ bộ nhớ khi một đối tượng/ phiên bản mới của lớp được tạo. Tất cả các lớp có phương pháp __init__.__init__ is a method or constructor in Python. This method is automatically called to allocate memory when a new object/ instance of a class is created. All classes have the __init__ method.__init__ is a method or constructor in Python. This method is automatically called to allocate memory when a new object/ instance of a class is created. All classes have the __init__ method.__init__ is a method or constructor in Python. This method is automatically called to allocate memory when a new object/ instance of a class is created. All classes have the __init__ method.

Dưới đây là một ví dụ về cách sử dụng nó.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
8

Output:

XYZ

23

20000

Q29. Hàm Lambda là gì?

Trả lời: Một hàm ẩn danh được gọi là hàm Lambda. Hàm này có thể có bất kỳ số lượng tham số nào, nhưng, chỉ có thể có một câu lệnh.An anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.An anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.An anonymous function is known as a lambda function. This function can have any number of parameters but, can have just one statement.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
1

Output: 11111111

Q30. Bản thân trong Python là gì?

Trả lời: Tự là một ví dụ hoặc một đối tượng của một lớp. Trong Python, điều này được bao gồm rõ ràng là tham số đầu tiên. Tuy nhiên, đây không phải là trường hợp ở Java, nơi nó tùy chọn. & NBSP; Nó giúp phân biệt giữa các phương thức và thuộc tính của một lớp với các biến cục bộ.Self is an instance or an object of a class. In Python, this is explicitly included as the first parameter. However, this is not the case in Java where it’s optional.  It helps to differentiate between the methods and attributes of a class with local variables.Self is an instance or an object of a class. In Python, this is explicitly included as the first parameter. However, this is not the case in Java where it’s optional.  It helps to differentiate between the methods and attributes of a class with local variables.Self is an instance or an object of a class. In Python, this is explicitly included as the first parameter. However, this is not the case in Java where it’s optional.  It helps to differentiate between the methods and attributes of a class with local variables.

Biến bản thân trong phương thức INIT đề cập đến đối tượng mới được tạo trong khi trong các phương thức khác, nó đề cập đến đối tượng có phương thức được gọi.

Q31. Làm thế nào để phá vỡ, tiếp tục và vượt qua công việc? How does break, continue and pass work?

Phá vỡ Cho phép chấm dứt vòng lặp khi một số điều kiện được đáp ứng và điều khiển được chuyển sang câu lệnh tiếp theo.
Tiếp tục Cho phép bỏ qua một phần của vòng lặp khi một số điều kiện cụ thể được đáp ứng và điều khiển được chuyển sang đầu vòng lặp
Đi qua Được sử dụng khi bạn cần một số khối mã cú pháp, nhưng bạn muốn bỏ qua việc thực thi của nó. Đây về cơ bản là một hoạt động null. Không có gì xảy ra khi điều này được thực hiện.

Q32. [::-1} làm gì?What does [::-1} do?

ANS: & nbsp; [::-1] được sử dụng để đảo ngược thứ tự của một mảng hoặc một chuỗi. [::-1] is used to reverse the order of an array or a sequence. [::-1] is used to reverse the order of an array or a sequence. [::-1] is used to reverse the order of an array or a sequence.

Ví dụ:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
7

Đầu ra: Mảng (‘I, [5, 4, 3, 2, 1]): array(‘i’, [5, 4, 3, 2, 1]): array(‘i’, [5, 4, 3, 2, 1]): array(‘i’, [5, 4, 3, 2, 1])

[::-1] In lại một bản sao đảo ngược của các cấu trúc dữ liệu được đặt hàng như một mảng hoặc một danh sách. Mảng ban đầu hoặc danh sách vẫn không thay đổi.

Q33. Làm thế nào bạn có thể chọn ngẫu nhiên các mục của một danh sách tại chỗ trong Python?

Trả lời: & nbsp; xem xét ví dụ được hiển thị bên dưới: Consider the example shown below: Consider the example shown below: Consider the example shown below:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
20
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
1 1 Đầu ra của mã sau như dưới đây.The output of the following code is as below.The output of the following code is as below.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
21The output of the following code is as below.
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
21

Q34. Trình lặp Python là gì?

ANS: tererators là đối tượng có thể đi qua mặc dù hoặc lặp đi lặp lại.Iterators are objects which can be traversed though or iterated upon.Iterators are objects which can be traversed though or iterated upon.Iterators are objects which can be traversed though or iterated upon.

Q35. Làm thế nào bạn có thể tạo ra các số ngẫu nhiên trong Python?

ANS: & NBSP; Mô -đun ngẫu nhiên là mô -đun tiêu chuẩn được sử dụng để tạo số ngẫu nhiên. Phương pháp được định nghĩa là: Random module is the standard module that is used to generate a random number. The method is defined as: Random module is the standard module that is used to generate a random number. The method is defined as: Random module is the standard module that is used to generate a random number. The method is defined as:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
22

Câu lệnh Random.Random () Phương thức trả về số điểm nổi nằm trong phạm vi của [0, 1). Hàm tạo ra số float ngẫu nhiên. Các phương pháp được sử dụng với lớp ngẫu nhiên là các phương thức ràng buộc của các trường hợp ẩn. Các phiên bản của ngẫu nhiên có thể được thực hiện để hiển thị các chương trình đa luồng tạo ra một thể hiện khác của các luồng riêng lẻ. Các máy phát ngẫu nhiên khác được sử dụng trong này là:

  1. Randrange (A, B): Nó chọn số nguyên và xác định phạm vi ở giữa [A, B). Nó trả về các phần tử bằng cách chọn nó ngẫu nhiên từ phạm vi được chỉ định. Nó không xây dựng một đối tượng phạm vi.: it chooses an integer and define the range in-between [a, b). It returns the elements by selecting it randomly from the range that is specified. It doesn’t build a range object. : it chooses an integer and define the range in-between [a, b). It returns the elements by selecting it randomly from the range that is specified. It doesn’t build a range object.
  2. đồng nhất (a, b): nó chọn số điểm nổi được xác định trong phạm vi của [a, b) .iyt trả về số điểm nổi: it chooses a floating point number that is defined in the range of [a,b).Iyt returns the floating point number: it chooses a floating point number that is defined in the range of [a,b).Iyt returns the floating point number
  3. NormalVariate (trung bình, SDEV): Nó được sử dụng cho phân phối bình thường trong đó MU là một giá trị trung bình và SDEV là một sigma được sử dụng cho độ lệch chuẩn.: it is used for the normal distribution where the mu is a mean and the sdev is a sigma that is used for standard deviation. : it is used for the normal distribution where the mu is a mean and the sdev is a sigma that is used for standard deviation.
  4. Lớp ngẫu nhiên được sử dụng và khởi tạo tạo ra nhiều trình tạo số ngẫu nhiên độc lập. that is used and instantiated creates independent multiple random number generators. that is used and instantiated creates independent multiple random number generators.

Q36. Sự khác biệt giữa phạm vi & xrange là gì?

Ans: & nbsp; đối với hầu hết các phần, xrange và phạm vi giống hệt nhau về chức năng. Cả hai đều cung cấp một cách để tạo ra một danh sách các số nguyên cho bạn sử dụng, tuy nhiên bạn xin vui lòng. Sự khác biệt duy nhất là phạm vi trả về một đối tượng danh sách Python và phạm vi X trả về một đối tượng xrange. For the most part, xrange and range are the exact same in terms of functionality. They both provide a way to generate a list of integers for you to use, however you please. The only difference is that range returns a Python list object and x range returns an xrange object. For the most part, xrange and range are the exact same in terms of functionality. They both provide a way to generate a list of integers for you to use, however you please. The only difference is that range returns a Python list object and x range returns an xrange object.

Điều này & nbsp; có nghĩa là Xrange không thực sự tạo ra một danh sách tĩnh ở thời gian chạy như phạm vi. Nó tạo ra các giá trị khi bạn cần chúng với một kỹ thuật đặc biệt gọi là năng suất. Kỹ thuật này được sử dụng với một loại đối tượng được gọi là Máy phát điện. & NBSP; điều đó có nghĩa là nếu bạn có phạm vi thực sự khổng lồ, bạn sẽ muốn tạo một danh sách cho, giả sử một tỷ, Xrange là chức năng sử dụng.

Điều này đặc biệt đúng nếu bạn có một hệ thống nhạy cảm bộ nhớ thực sự như điện thoại di động mà bạn đang làm việc, vì phạm vi sẽ sử dụng nhiều bộ nhớ nhất có thể để tạo ra các số nguyên của bạn, có thể dẫn đến lỗi bộ nhớ và làm hỏng chương trình. Nó là một con thú đói trí nhớ.

Q37. Làm thế nào để bạn viết bình luận trong Python?

Trả lời: Nhận xét trong Python bắt đầu với một ký tự #. Tuy nhiên, đôi khi đôi khi, bình luận được thực hiện bằng cách sử dụng DocStrings (các chuỗi được bao quanh trong ba trích dẫn).Comments in Python start with a # character. However, alternatively at times, commenting is done using docstrings(strings enclosed within triple quotes).Comments in Python start with a # character. However, alternatively at times, commenting is done using docstrings(strings enclosed within triple quotes).

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
23

Đầu ra: & nbsp; Nhận xét trong Python bắt đầu với một #Comments in Python start with a #Comments in Python start with a #

Q38. Pickling và Unbickling là gì?

ANS: & NBSP; Mô -đun Pickle chấp nhận bất kỳ đối tượng Python nào và chuyển đổi nó thành một biểu diễn chuỗi và đổ nó vào một tệp bằng cách sử dụng chức năng kết xuất, quá trình này được gọi là Pickling. Trong khi quá trình truy xuất các đối tượng Python gốc từ biểu diễn chuỗi được lưu trữ được gọi là không có tính cách. Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling. Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling.

Q39. Các máy phát điện trong Python là gì?

Trả lời: Các chức năng trả về một tập hợp các mục được gọi là máy phát điện.Functions that return an iterable set of items are called generators.Functions that return an iterable set of items are called generators.Functions that return an iterable set of items are called generators.

Q40. Làm thế nào bạn sẽ viết hoa chữ cái đầu tiên của chuỗi?

Trả lời: Trong Python, phương thức

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
32 viết hoa chữ cái đầu tiên của một chuỗi. Nếu chuỗi đã bao gồm một chữ cái viết hoa ở đầu, thì nó sẽ trả về chuỗi gốc.In Python, the
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
12 method capitalizes the first letter of a string. If the string already consists of a capital letter at the beginning, then, it returns the original string.2 viết hoa chữ cái đầu tiên của một chuỗi. Nếu chuỗi đã bao gồm một chữ cái viết hoa ở đầu, thì nó sẽ trả về chuỗi gốc.In Python, the
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
12 method capitalizes the first letter of a string. If the string already consists of a capital letter at the beginning, then, it returns the original string.2 viết hoa chữ cái đầu tiên của một chuỗi. Nếu chuỗi đã bao gồm một chữ cái viết hoa ở đầu, thì nó sẽ trả về chuỗi gốc.In Python, the
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
12 method capitalizes the first letter of a string. If the string already consists of a capital letter at the beginning, then, it returns the original string.

Q41. Làm thế nào bạn sẽ chuyển đổi một chuỗi thành tất cả các chữ thường?

Trả lời: Để chuyển đổi một chuỗi thành chữ thường, hàm thấp hơn () có thể được sử dụng.To convert a string to lowercase, lower() function can be used.To convert a string to lowercase, lower() function can be used.To convert a string to lowercase, lower() function can be used.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
24

Đầu ra: ABCDabcdabcdabcd

Q42. Làm thế nào để nhận xét nhiều dòng trong Python?

Trả lời: Nhận xét đa dòng xuất hiện trong nhiều dòng. Tất cả các dòng được nhận xét sẽ được tiền tố bởi ____ 83. & nbsp; Bạn cũng có thể một phương pháp rất tốt & nbsp; phím tắt để nhận xét nhiều dòng. Tất cả những gì bạn cần làm là giữ ctrl & nbsp; key và & nbsp; nhấp chuột trái & nbsp; ở mọi nơi bạn muốn bao gồm một ký tự # và nhập A # chỉ một lần. Điều này sẽ nhận xét tất cả các dòng nơi bạn giới thiệu con trỏ của bạn.Multi-line comments appear in more than one line. All the lines to be commented are to be prefixed by a Multi-line comments appear in more than one line. All the lines to be commented are to be prefixed by a Multi-line comments appear in more than one line. All the lines to be commented are to be prefixed by a

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
13. You can also a very good shortcut method to comment multiple lines. All you need to do is hold the ctrl key and left click in every place wherever you want to include a # character and type a # just once. This will comment all the lines where you introduced your cursor.shortcut method to comment multiple lines. All you need to do is hold the ctrl key and left click in every place wherever you want to include a # character and type a # just once. This will comment all the lines where you introduced your cursor.shortcut method to comment multiple lines. All you need to do is hold the ctrl key and left click in every place wherever you want to include a # character and type a # just once. This will comment all the lines where you introduced your cursor.

Câu 43. Docstrings trong Python là gì?

Trả lời: Docstrings không thực sự là bình luận, nhưng, chúng là & nbsp; chuỗi tài liệu. Những tài liệu này nằm trong ba trích dẫn. Chúng không được chỉ định cho bất kỳ biến nào và do đó, đôi khi, cũng phục vụ mục đích của các bình luận.Docstrings are not actually comments, but, they are documentation strings. These docstrings are within triple quotes. They are not assigned to any variable and therefore, at times, serve the purpose of comments as well.Docstrings are not actually comments, but, they are documentation strings. These docstrings are within triple quotes. They are not assigned to any variable and therefore, at times, serve the purpose of comments as well.Docstrings are not actually comments, but, they are documentation strings. These docstrings are within triple quotes. They are not assigned to any variable and therefore, at times, serve the purpose of comments as well.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
25

Đầu ra: 2.02.02.02.0

Q44. Mục đích của ‘là,’ không phải là người vận hành và trong các nhà khai thác?

ANS: Các nhà khai thác là các chức năng đặc biệt. Họ lấy một hoặc nhiều giá trị và tạo ra một kết quả tương ứng.Operators are special functions. They take one or more values and produce a corresponding result.Operators are special functions. They take one or more values and produce a corresponding result.Operators are special functions. They take one or more values and produce a corresponding result.

là: trả về đúng khi 2 toán hạng là đúng & nbsp; (Ví dụ: Một người khác là ’: returns true when 2 operands are true  (Example: “a” is ‘a’): returns true when 2 operands are true  (Example: “a” is ‘a’): returns true when 2 operands are true  (Example: “a” is ‘a’)

Không: Trả về nghịch đảo của giá trị boolean: returns the inverse of the boolean value: returns the inverse of the boolean value: returns the inverse of the boolean value

Trong: Kiểm tra xem một số phần tử có mặt trong một số chuỗi không: checks if some element is present in some sequence: checks if some element is present in some sequence: checks if some element is present in some sequence

Q45. Việc sử dụng hàm trợ giúp () và dir () trong Python là gì?

Ans: & nbsp; help () và dir () Cả hai hàm đều có thể truy cập được từ trình thông dịch Python và được sử dụng để xem một kết xuất các chức năng tích hợp tích hợp. & NBSP; Help() and dir() both functions are accessible from the Python interpreter and used for viewing a consolidated dump of built-in functions.  Help() and dir() both functions are accessible from the Python interpreter and used for viewing a consolidated dump of built-in functions.  Help() and dir() both functions are accessible from the Python interpreter and used for viewing a consolidated dump of built-in functions. 

  1. HELP () Hàm: hàm trợ giúp () được sử dụng để hiển thị chuỗi tài liệu và cũng tạo điều kiện cho bạn thấy trợ giúp liên quan đến các mô -đun, từ khóa, thuộc tính, v.v.: The help() function is used to display the documentation string and also facilitates you to see the help related to modules, keywords, attributes, etc.: The help() function is used to display the documentation string and also facilitates you to see the help related to modules, keywords, attributes, etc.: The help() function is used to display the documentation string and also facilitates you to see the help related to modules, keywords, attributes, etc.
  2. Hàm dir (): hàm dir () được sử dụng để hiển thị các ký hiệu được xác định.: The dir() function is used to display the defined symbols.: The dir() function is used to display the defined symbols.: The dir() function is used to display the defined symbols.

Q46. Bất cứ khi nào Python thoát ra, tại sao tất cả các bộ nhớ bị phân bổ?

Ans:

  1. Bất cứ khi nào Python thoát ra, đặc biệt là các mô-đun Python có các tham chiếu tròn đến các đối tượng khác hoặc các đối tượng được tham chiếu từ các không gian tên toàn cầu không phải lúc nào cũng được phân bổ hoặc giải phóng.
  2. Không thể phân bổ phân bổ các phần của bộ nhớ được bảo lưu bởi thư viện C.
  3. Khi thoát, do có cơ chế dọn dẹp hiệu quả của riêng mình, Python sẽ cố gắng phân bổ/phá hủy mọi đối tượng khác.

Q47. Từ điển trong Python là gì?

ANS: & NBSP; Các kiểu dữ liệu tích hợp trong Python được gọi là từ điển. Nó xác định mối quan hệ một-một giữa các khóa và giá trị. Từ điển chứa cặp khóa và giá trị tương ứng của chúng. Từ điển được lập chỉ mục bởi các khóa. The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys. The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys. The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys.

Hãy lấy một ví dụ:

Ví dụ sau đây chứa một số khóa. Quốc gia, Thủ đô & PM. Các giá trị tương ứng của chúng là Ấn Độ, Delhi và Modi tương ứng.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
26
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
27
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
28
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
29
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
30
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
3 1
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
32

Q48. Làm thế nào các toán tử ternary có thể được sử dụng trong Python? How can the ternary operators be used in python?

ANS: & nbsp; toán tử ternary là toán tử được sử dụng để hiển thị các câu lệnh có điều kiện. Điều này bao gồm các giá trị đúng hoặc sai với một tuyên bố phải được đánh giá cho nó. The Ternary operator is the operator that is used to show the conditional statements. This consists of the true or false values with a statement that has to be evaluated for it. The Ternary operator is the operator that is used to show the conditional statements. This consists of the true or false values with a statement that has to be evaluated for it. The Ternary operator is the operator that is used to show the conditional statements. This consists of the true or false values with a statement that has to be evaluated for it.

Syntax::::

Toán tử ternary sẽ được đưa ra như:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
14

Example:

Biểu thức được đánh giá như nếu x

Q49. Điều này có nghĩa là gì: *args, ** kwargs? Và tại sao chúng ta sẽ sử dụng nó?

Trả lời: & nbsp; chúng tôi sử dụng *args khi chúng tôi chắc chắn có bao nhiêu đối số sẽ được chuyển đến một chức năng hoặc nếu chúng tôi muốn chuyển một danh sách được lưu trữ hoặc tìm các đối số cho một hàm. ** kwargs được sử dụng khi chúng tôi không biết có bao nhiêu đối số từ khóa sẽ được truyền đến một hàm hoặc nó có thể được sử dụng để truyền các giá trị của từ điển làm đối số từ khóa. Các định danh ARGS và KWARG là một quy ước, bạn cũng có thể sử dụng *Bob và ** Billy nhưng điều đó sẽ không khôn ngoan. We use *args when we aren’t sure how many arguments are going to be passed to a function, or if we want to pass a stored list or tuple of arguments to a function. **kwargs is used when we don’t know how many keyword arguments will be passed to a function, or it can be used to pass the values of a dictionary as keyword arguments. The identifiers args and kwargs are a convention, you could also use *bob and **billy but that would not be wise. We use *args when we aren’t sure how many arguments are going to be passed to a function, or if we want to pass a stored list or tuple of arguments to a function. **kwargs is used when we don’t know how many keyword arguments will be passed to a function, or it can be used to pass the values of a dictionary as keyword arguments. The identifiers args and kwargs are a convention, you could also use *bob and **billy but that would not be wise. We use *args when we aren’t sure how many arguments are going to be passed to a function, or if we want to pass a stored list or tuple of arguments to a function. **kwargs is used when we don’t know how many keyword arguments will be passed to a function, or it can be used to pass the values of a dictionary as keyword arguments. The identifiers args and kwargs are a convention, you could also use *bob and **billy but that would not be wise.

Q50. Len () làm gì?

Trả lời: Nó được sử dụng để xác định độ dài của chuỗi, danh sách, một mảng, v.v.It is used to determine the length of a string, a list, an array, etc.It is used to determine the length of a string, a list, an array, etc.It is used to determine the length of a string, a list, an array, etc.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
33

Đầu ra: 4:4 :4 :4

Q51. Giải thích Split (), Sub (), Subn () của mô -đun RE RE trong Python.

ANS: & NBSP; Để sửa đổi các chuỗi, mô -đun Python trong thời gian đang cung cấp 3 phương pháp. Họ đang: To modify the strings, Python’s “re” module is providing 3 methods. They are: To modify the strings, Python’s “re” module is providing 3 methods. They are: To modify the strings, Python’s “re” module is providing 3 methods. They are:

  • Split () - Sử dụng mẫu regex để chia tách một chuỗi đã cho vào danh sách. – uses a regex pattern to “split” a given string into a list. – uses a regex pattern to “split” a given string into a list. – uses a regex pattern to “split” a given string into a list.
  • sub () - Tìm tất cả các chuỗi con trong đó mẫu regex khớp và sau đó thay thế chúng bằng một chuỗi khác – finds all substrings where the regex pattern matches and then replace them with a different string – finds all substrings where the regex pattern matches and then replace them with a different string – finds all substrings where the regex pattern matches and then replace them with a different string
  • subn () - nó tương tự như sub () và cũng trả về chuỗi mới cùng với số không. của sự thay thế. – it is similar to sub() and also returns the new string along with the no. of replacements. – it is similar to sub() and also returns the new string along with the no. of replacements. – it is similar to sub() and also returns the new string along with the no. of replacements.

Q52. Các chỉ mục tiêu cực là gì và tại sao chúng được sử dụng?What are negative indexes and why are they used?

Trả lời: Các chuỗi trong Python được lập chỉ mục và nó bao gồm các số dương cũng như số âm. Các số sử dụng tích cực ‘0, được sử dụng làm chỉ mục đầu tiên và‘ 1, là chỉ mục thứ hai và quá trình diễn ra như thế.The sequences in Python are indexed and it consists of the positive as well as negative numbers. The numbers that are positive uses ‘0’ that is uses as first index and ‘1’ as the second index and the process goes on like that. The sequences in Python are indexed and it consists of the positive as well as negative numbers. The numbers that are positive uses ‘0’ that is uses as first index and ‘1’ as the second index and the process goes on like that. The sequences in Python are indexed and it consists of the positive as well as negative numbers. The numbers that are positive uses ‘0’ that is uses as first index and ‘1’ as the second index and the process goes on like that.

Chỉ số cho số âm bắt đầu từ ‘-1, đại diện cho chỉ số cuối cùng trong chuỗi và‘ -2, là chỉ số áp chót và trình tự chuyển tiếp như số dương.

Chỉ số âm được sử dụng để loại bỏ bất kỳ không gian dòng mới nào khỏi chuỗi và cho phép chuỗi ngoại trừ ký tự cuối cùng được đưa ra là S [:-1]. Chỉ số âm cũng được sử dụng để hiển thị chỉ mục để biểu diễn chuỗi theo thứ tự chính xác.

Q53. & NBSP; Gói Python là gì? What are Python packages?

ANS: Gói Python là không gian tên chứa nhiều mô -đun.Python packages are namespaces containing multiple modules.Python packages are namespaces containing multiple modules.Python packages are namespaces containing multiple modules.

Q54. Làm thế nào các tệp có thể bị xóa trong Python?

Trả lời: Để xóa một tệp trong Python, bạn cần nhập mô -đun HĐH. Sau đó, bạn cần sử dụng hàm os.remove ().To delete a file in Python, you need to import the OS Module. After that, you need to use the os.remove() function.To delete a file in Python, you need to import the OS Module. After that, you need to use the os.remove() function.To delete a file in Python, you need to import the OS Module. After that, you need to use the os.remove() function.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
34

Q55. Các loại python tích hợp là gì?

Trả lời: Các loại tích hợp trong Python như sau-Built-in types in Python are as follows –Built-in types in Python are as follows –Built-in types in Python are as follows –

  • Số nguyên
  • Floating-point
  • Số phức
  • Dây
  • Boolean
  • Chức năng tích hợp sẵn

Q56. Những lợi thế nào mà các mảng numpy cung cấp so với danh sách python (lồng nhau)?

Ans:    

  1. Danh sách Python là các thùng chứa mục đích chung hiệu quả. Họ hỗ trợ (một cách công bằng) việc chèn, xóa, nối lại và nối, và sự hiểu biết của Python, làm cho chúng dễ dàng xây dựng và thao túng.
  2. Chúng có những hạn chế nhất định: chúng không hỗ trợ các hoạt động của vectơ được vectơ như bổ sung và nhân vào phần tử, và thực tế là chúng có thể chứa các đối tượng của các loại khác nhau có nghĩa là Python phải lưu trữ thông tin loại cho mọi yếu tố và phải thực thi mã gửi loại khi vận hành trên mỗi yếu tố.
  3. Numpy không chỉ hiệu quả hơn; Nó cũng thuận tiện hơn. Bạn nhận được rất nhiều hoạt động vectơ và ma trận miễn phí, đôi khi cho phép người ta tránh công việc không cần thiết. Và họ cũng được thực hiện hiệu quả.
  4. Mảng Numpy nhanh hơn và bạn được tích hợp rất nhiều với Numpy, FFT, chập, tìm kiếm nhanh, thống kê cơ bản, đại số tuyến tính, biểu đồ, vv & nbsp;   

Q57. Làm thế nào để thêm các giá trị vào một mảng Python? How to add values to a python array?

Trả lời: Các phần tử có thể được thêm vào một mảng & nbsp; sử dụng & nbsp; append (), & nbsp; extend () & nbsp; và & nbsp; chèn (i, x) & nbsp; hàm.Elements can be added to an array using the append(), extend() and the insert (i,x) functions.Elements can be added to an array using the append(), extend() and the insert (i,x) functions.Elements can be added to an array using the append()extend() and the insert (i,x) functions.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
35

Output:

Mảng (‘D, [1.1, 2.1, 3.1, 3.4])

Mảng (‘D, [1.1, 2.1, 3.1, 3.4, 4.5, 6.3, 6.8])

Mảng (‘D, [1.1, 2.1, 3.8, 3.1, 3.4, 4.5, 6.3, 6.8])

Q58. Làm thế nào để loại bỏ các giá trị vào một mảng python?

Trả lời: Các thành phần mảng có thể được xóa bằng & nbsp; pop () & nbsp; hoặc & nbsp; Remove () & nbsp; phương thức. Sự khác biệt giữa hai chức năng này là cái trước trả về giá trị bị xóa trong khi cái sau thì không.Array elements can be removed using pop() or remove() method. The difference between these two functions is that the former returns the deleted value whereas the latter does not.Array elements can be removed using pop() or remove() method. The difference between these two functions is that the former returns the deleted value whereas the latter does not.Array elements can be removed using pop() or remove() method. The difference between these two functions is that the former returns the deleted value whereas the latter does not.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
36

Output:

4.6

3.1

Mảng (‘D, [2.2, 3.8, 3.7, 1.2])

Câu 59.does Python có khái niệm rất tiếc? Does Python have OOps concepts?

Trả lời: Python là ngôn ngữ lập trình hướng đối tượng. Điều này có nghĩa là bất kỳ chương trình nào cũng có thể được giải quyết bằng Python bằng cách tạo một mô hình đối tượng. Tuy nhiên, Python có thể được coi là một ngôn ngữ về thủ tục cũng như cấu trúc.Python is an object-oriented programming language. This means that any program can be solved in python by creating an object model. However, Python can be treated as a procedural as well as structural language.Python is an object-oriented programming language. This means that any program can be solved in python by creating an object model. However, Python can be treated as a procedural as well as structural language.Python is an object-oriented programming language. This means that any program can be solved in python by creating an object model. However, Python can be treated as a procedural as well as structural language.

Kiểm tra các khóa học AI và ML của Học viện E & ICT NIT Warangal để học cách sử dụng Python trong AI ML và xây dựng một sự nghiệp thành công.

Q60. Sự khác biệt giữa bản sao sâu và nông là gì?

Ans: & nbsp; bản sao nông được sử dụng khi loại thể hiện mới được tạo và nó giữ các giá trị được sao chép trong thể hiện mới. Bản sao nông được sử dụng để sao chép các con trỏ tham chiếu giống như nó sao chép các giá trị. Các tài liệu tham khảo này chỉ ra các đối tượng gốc và các thay đổi được thực hiện trong bất kỳ thành viên nào trong lớp cũng sẽ ảnh hưởng đến bản sao gốc của nó. & NBSP; bản sao nông cho phép thực hiện nhanh hơn chương trình và nó phụ thuộc vào kích thước của dữ liệu được sử dụng. Shallow copy is used when a new instance type gets created and it keeps the values that are copied in the new instance. Shallow copy is used to copy the reference pointers just like it copies the values. These references point to the original objects and the changes made in any member of the class will also affect the original copy of it. Shallow copy allows faster execution of the program and it depends on the size of the data that is used. Shallow copy is used when a new instance type gets created and it keeps the values that are copied in the new instance. Shallow copy is used to copy the reference pointers just like it copies the values. These references point to the original objects and the changes made in any member of the class will also affect the original copy of it. Shallow copy allows faster execution of the program and it depends on the size of the data that is used. Shallow copy is used when a new instance type gets created and it keeps the values that are copied in the new instance. Shallow copy is used to copy the reference pointers just like it copies the values. These references point to the original objects and the changes made in any member of the class will also affect the original copy of it. Shallow copy allows faster execution of the program and it depends on the size of the data that is used.

Bản sao sâu được sử dụng để lưu trữ các giá trị đã được sao chép. & NBSP; Sao chép sâu không sao chép các con trỏ tham chiếu vào các đối tượng. Nó làm cho tham chiếu đến một đối tượng và đối tượng mới được chỉ ra bởi một số đối tượng khác được lưu trữ. Các thay đổi được thực hiện trong bản sao gốc won đã ảnh hưởng đến bất kỳ bản sao nào khác sử dụng đối tượng. & NBSP; Bản sao sâu làm cho việc thực thi chương trình chậm hơn do thực hiện các bản sao nhất định cho mỗi đối tượng được gọi.

Q61. Làm thế nào là đa luồng đạt được trong Python?

Ans:    

  1. Python có gói đa luồng nhưng nếu bạn muốn đa luồng để tăng tốc mã của mình, thì nó thường không phải là một ý tưởng tốt để sử dụng nó.
  2. Python có một cấu trúc gọi là khóa phiên dịch toàn cầu (GIL). GIL đảm bảo rằng chỉ một trong các chủ đề của bạn có thể thực thi bất cứ lúc nào. Một chủ đề có được GIL, làm một chút công việc, sau đó chuyển Gil lên luồng tiếp theo.
  3. Điều này xảy ra rất nhanh, vì vậy, mắt người có vẻ như các chủ đề của bạn đang thực hiện song song, nhưng chúng thực sự chỉ thay phiên nhau bằng cách sử dụng cùng một lõi CPU.
  4. Tất cả Gil này vượt qua thêm chi phí để thực hiện. Điều này có nghĩa là nếu bạn muốn làm cho mã của bạn chạy nhanh hơn thì sử dụng gói luồng thường không phải là một ý tưởng tốt.

Q62. Quá trình biên dịch và liên kết trong Python là gì? What is the process of compilation and linking in python?

ANS: & NBSP; Việc biên dịch và liên kết cho phép các tiện ích mở rộng mới được biên dịch đúng mà không có bất kỳ lỗi nào và liên kết chỉ có thể được thực hiện khi vượt qua quy trình biên dịch. Nếu tải động được sử dụng thì nó phụ thuộc vào phong cách đang được cung cấp với hệ thống. Trình thông dịch Python có thể được sử dụng để cung cấp tải động của các tệp thiết lập cấu hình và sẽ xây dựng lại trình thông dịch. The compiling and linking allow the new extensions to be compiled properly without any error and the linking can be done only when it passes the compiled procedure. If the dynamic loading is used then it depends on the style that is being provided with the system. The python interpreter can be used to provide the dynamic loading of the configuration setup files and will rebuild the interpreter. The compiling and linking allow the new extensions to be compiled properly without any error and the linking can be done only when it passes the compiled procedure. If the dynamic loading is used then it depends on the style that is being provided with the system. The python interpreter can be used to provide the dynamic loading of the configuration setup files and will rebuild the interpreter. The compiling and linking allow the new extensions to be compiled properly without any error and the linking can be done only when it passes the compiled procedure. If the dynamic loading is used then it depends on the style that is being provided with the system. The python interpreter can be used to provide the dynamic loading of the configuration setup files and will rebuild the interpreter.

Các bước được yêu cầu trong việc này như:

  1. Tạo một tệp với bất kỳ tên nào và trong bất kỳ ngôn ngữ nào được hỗ trợ bởi trình biên dịch của hệ thống của bạn. Ví dụ: Tệp.c hoặc File.cpp
  2. Đặt tệp này vào các mô -đun/ thư mục của phân phối đang được sử dụng.
  3. Thêm một dòng trong cài đặt tệp. Lô có trong các mô -đun/ thư mục.
  4. Chạy tệp bằng tệp spam.o
  5. Sau khi chạy thành công, việc xây dựng lại trình thông dịch bằng cách sử dụng lệnh Make trên thư mục cấp cao nhất.
  6. Nếu tệp được thay đổi thì hãy chạy RebuildMakeFile bằng cách sử dụng lệnh như ‘Makefile.

Q63. Thư viện Python là gì? Kể tên một vài trong số họ.What are Python libraries? Name a few of them.

Thư viện Python là một bộ sưu tập các gói Python. Một số thư viện Python được sử dụng chủ yếu là-Numpy, Pandas, Matplotlib, Scikit-Learn và nhiều hơn nữa.

Q64. & Nbsp; được chia cho cái gì được sử dụng cho? What is split used for?

Phương thức chia () được sử dụng để tách một chuỗi đã cho trong Python.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
37

Đầu ra: & nbsp; [‘Edureka,‘ Python,][‘edureka’, ‘python’][‘edureka’, ‘python’][‘edureka’, ‘python’]

Q65. Làm thế nào để nhập các mô -đun trong Python?How to import modules in python?How to import modules in python?How to import modules in python?

Các mô -đun có thể được nhập bằng cách sử dụng Nhập & NBSP; Từ khóa. & NBSP; Bạn có thể nhập các mô-đun theo ba cách-import keyword.  You can import modules in three ways-import keyword.  You can import modules in three ways-import keyword.  You can import modules in three ways-

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
38

Tiếp theo, trong blog câu hỏi phỏng vấn Python này, hãy để Lôi xem các khái niệm hướng đối tượng trong Python.

Dưới đây là danh sách 10 công nghệ xu hướng hàng đầu vào năm 2022 sẽ có nhu cầu!

Câu hỏi và câu trả lời phỏng vấn Python | Chuẩn bị phỏng vấn Python | Edureka

Những câu hỏi và câu trả lời phỏng vấn Python này sẽ giúp bạn chuẩn bị cho các cuộc phỏng vấn việc làm Python. Bắt đầu chuẩn bị của bạn bằng cách trải qua các câu hỏi thường gặp nhất trên Python.

Rất tiếc, câu hỏi phỏng vấn PythonPython Interview Questions

Q66. Giải thích kế thừa trong Python với một ví dụ.

Ans: & nbsp; kế thừa cho phép một lớp đạt được tất cả các thành viên (giả sử các thuộc tính và phương thức) của một lớp khác. Kế thừa cung cấp khả năng tái sử dụng mã, giúp dễ dàng tạo và duy trì một ứng dụng hơn. Lớp mà chúng ta đang thừa kế được gọi là siêu lớp và lớp được thừa hưởng được gọi là lớp dẫn xuất / trẻ em. Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code reusability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class. Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code reusability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class. Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code reusability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class.

Chúng là các loại kế thừa khác nhau được hỗ trợ bởi Python:

  1. Kế thừa duy nhất - trong đó một lớp có nguồn gốc có được các thành viên của một siêu lớp duy nhất. – where a derived class acquires the members of a single super class. – where a derived class acquires the members of a single super class. – where a derived class acquires the members of a single super class.
  2. Di truyền đa cấp-Một lớp D1 có nguồn gốc được kế thừa từ cơ sở cơ sở1 và D2 ​​được kế thừa từ base2. – a derived class d1 in inherited from base class base1, and d2 are inherited from base2. – a derived class d1 in inherited from base class base1, and d2 are inherited from base2. – a derived class d1 in inherited from base class base1, and d2 are inherited from base2.
  3. Di truyền phân cấp - Từ một lớp cơ sở, bạn có thể thừa hưởng bất kỳ số lượng lớp con nào – from one base class you can inherit any number of child classes – from one base class you can inherit any number of child classes – from one base class you can inherit any number of child classes
  4. Nhiều kế thừa - một lớp dẫn xuất được kế thừa từ nhiều lớp cơ sở. – a derived class is inherited from more than one base class. – a derived class is inherited from more than one base class. – a derived class is inherited from more than one base class.

Q67. Làm thế nào các lớp được tạo ra trong Python? & NBSP;

ANS: Lớp trong Python được tạo bằng cách sử dụng từ khóa lớp.Class in Python is created using the class keyword.Class in Python is created using the class keyword.Class in Python is created using the class keyword.

Example:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
39

Đầu ra: ABCabcabcabc

Q68. Khỉ vá ở Python là gì?What is monkey patching in Python?

Ans: & nbsp; Trong Python, thuật ngữ bản vá khỉ chỉ đề cập đến các sửa đổi động của một lớp hoặc mô-đun tại thời gian chạy. In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time. In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time. In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time.

Xem xét ví dụ dưới đây:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
00

Sau đó chúng ta có thể chạy thử nghiệm khỉ như thế này:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
01

Đầu ra sẽ như dưới đây:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
02

Như chúng ta có thể thấy, chúng tôi đã thực hiện một số thay đổi trong hành vi của & nbsp; f () & nbsp; in & nbsp; myClass & nbsp; sử dụng chức năng mà chúng tôi đã xác định, & nbsp; monkey_f (), bên ngoài mô -đun & nbsp; m.

Q69. Python có hỗ trợ nhiều kế thừa không?

Trả lời: Nhiều kế thừa có nghĩa là một lớp có thể được lấy từ nhiều lớp cha. Python hỗ trợ nhiều kế thừa, không giống như Java.Multiple inheritance means that a class can be derived from more than one parent classes. Python does support multiple inheritance, unlike Java.Multiple inheritance means that a class can be derived from more than one parent classes. Python does support multiple inheritance, unlike Java.Multiple inheritance means that a class can be derived from more than one parent classes. Python does support multiple inheritance, unlike Java.

Q70. Đa hình trong Python là gì?. What is Polymorphism in Python?

ANS: Đa hình có nghĩa là khả năng có nhiều hình thức. Vì vậy, ví dụ, nếu lớp cha có một phương thức có tên ABC thì lớp con cũng có thể có một phương thức có cùng tên ABC có các tham số và biến riêng của nó. Python cho phép đa hình.Polymorphism means the ability to take multiple forms. So, for instance, if the parent class has a method named ABC then the child class also can have a method with the same name ABC having its own parameters and variables. Python allows polymorphism.Polymorphism means the ability to take multiple forms. So, for instance, if the parent class has a method named ABC then the child class also can have a method with the same name ABC having its own parameters and variables. Python allows polymorphism.Polymorphism means the ability to take multiple forms. So, for instance, if the parent class has a method named ABC then the child class also can have a method with the same name ABC having its own parameters and variables. Python allows polymorphism.

Q71. Xác định đóng gói trong Python?

Trả lời: Đóng gói có nghĩa là liên kết mã và dữ liệu với nhau. Một lớp Python trong một ví dụ về đóng gói.Encapsulation means binding the code and the data together. A Python class in an example of encapsulation.Encapsulation means binding the code and the data together. A Python class in an example of encapsulation.Encapsulation means binding the code and the data together. A Python class in an example of encapsulation.

Q72. Làm thế nào để bạn thực hiện trừu tượng dữ liệu trong Python?

Trả lời: Trừu tượng dữ liệu chỉ cung cấp các chi tiết cần thiết và che giấu việc triển khai khỏi thế giới. Nó có thể đạt được trong Python bằng cách sử dụng các giao diện và các lớp trừu tượng.Data Abstraction is providing only the required details and hiding the implementation from the world. It can be achieved in Python by using interfaces and abstract classes.Data Abstraction is providing only the required details and hiding the implementation from the world. It can be achieved in Python by using interfaces and abstract classes.Data Abstraction is providing only the required details and hiding the implementation from the world. It can be achieved in Python by using interfaces and abstract classes.

Q73.does Python sử dụng các nhà xác định truy cập?

Trả lời: Python không tước quyền truy cập vào một biến hoặc hàm thể hiện. Python đặt ra khái niệm tiền tố tên của biến, chức năng hoặc phương thức với một dấu gạch dưới hoặc kép để bắt chước hành vi của các nhà xác định truy cập được bảo vệ và riêng tư. & NBSP; & nbsp;Python does not deprive access to an instance variable or function. Python lays down the concept of prefixing the name of the variable, function or method with a single or double underscore to imitate the behavior of protected and private access specifiers.  Python does not deprive access to an instance variable or function. Python lays down the concept of prefixing the name of the variable, function or method with a single or double underscore to imitate the behavior of protected and private access specifiers.  Python does not deprive access to an instance variable or function. Python lays down the concept of prefixing the name of the variable, function or method with a single or double underscore to imitate the behavior of protected and private access specifiers.  

Q74. Làm thế nào để tạo một lớp trống trong Python? & NBSP;

Trả lời: Một lớp trống là một lớp không có bất kỳ mã nào được xác định trong khối của nó. Nó có thể được tạo bằng cách sử dụng & nbsp; pass & nbsp; từ khóa. Tuy nhiên, bạn có thể tạo các đối tượng của lớp này bên ngoài lớp. Trong Python, lệnh pass không làm gì khi nó được thực hiện. Nó là một tuyên bố null. & NBSP;An empty class is a class that does not have any code defined within its block. It can be created using the pass keyword. However, you can create objects of this class outside the class itself. IN PYTHON THE PASS command does nothing when its executed. it’s a null statement. An empty class is a class that does not have any code defined within its block. It can be created using the pass keyword. However, you can create objects of this class outside the class itself. IN PYTHON THE PASS command does nothing when its executed. it’s a null statement. An empty class is a class that does not have any code defined within its block. It can be created using the pass keyword. However, you can create objects of this class outside the class itself. IN PYTHON THE PASS command does nothing when its executed. it’s a null statement. 

Ví dụ-

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
03

Output: 

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
04

Q75. Một đối tượng () làm gì?

Trả lời: Nó trả về một đối tượng vô dụng là cơ sở cho tất cả các lớp. Ngoài ra, nó không lấy bất kỳ thông số nào.It returns a featureless object that is a base for all classes. Also, it does not take any parameters.It returns a featureless object that is a base for all classes. Also, it does not take any parameters.It returns a featureless object that is a base for all classes. Also, it does not take any parameters.

Tiếp theo, chúng ta hãy xem một số chương trình Python cơ bản trong các câu hỏi phỏng vấn Python này.

Các chương trình Python cơ bản - Câu hỏi phỏng vấn Python

Q76. Viết một chương trình trong Python để thực hiện thuật toán sắp xếp bong bóng.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
05

Đầu ra: & nbsp; [3, 5, 6, 7, 32, 54, 87][3, 5, 6, 7, 32, 54, 87][3, 5, 6, 7, 32, 54, 87][3, 5, 6, 7, 32, 54, 87]

Q77. Viết một chương trình bằng Python để sản xuất Tam giác Star.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
06
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
07

Output:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
08

Q78. Viết một chương trình để sản xuất loạt Fibonacci trong Python.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
09

Đầu ra: Nhập các Điều khoản 5 0 1 1 2 3 Enter the terms 5 0 1 1 2 3 Enter the terms 5 0 1 1 2 3 Enter the terms 5 0 1 1 2 3

Q79. Viết một chương trình bằng Python để kiểm tra xem một số là số nguyên tố.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
20

Output:

Nhập số 3

Xuất sắc

Q80. Viết một chương trình bằng Python để kiểm tra xem một chuỗi có phải là một palindrom không.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
21

Output:

Nhập trình tự 323 palindrom

Q81. Viết một lớp lót sẽ đếm số lượng chữ in hoa trong một tệp. Mã của bạn sẽ hoạt động ngay cả khi tệp quá lớn để phù hợp với bộ nhớ.

Ans: & nbsp; & nbsp; Trước tiên chúng ta hãy viết một giải pháp nhiều dòng và sau đó chuyển đổi nó thành mã một lớp.  Let us first write a multiple line solution and then convert it to one-liner code.  Let us first write a multiple line solution and then convert it to one-liner code.  Let us first write a multiple line solution and then convert it to one-liner code.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
22

Bây giờ chúng tôi sẽ cố gắng biến điều này thành một dòng duy nhất.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
23

Q82. Viết một thuật toán sắp xếp cho một bộ dữ liệu số trong Python.

ANS: & NBSP; Mã sau có thể được sử dụng để sắp xếp danh sách trong Python: The following code can be used to sort a list in Python: The following code can be used to sort a list in Python: The following code can be used to sort a list in Python:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
24

Q83. Nhìn vào mã dưới đây, hãy viết ra các giá trị cuối cùng của A0, A1, AN AN.

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
25

ANS: & NBSP; Sau đây sẽ là đầu ra cuối cùng của A0, A1, A6 A6 The following will be the final outputs of A0, A1, … A6 The following will be the final outputs of A0, A1, … A6 The following will be the final outputs of A0, A1, … A6

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
26

Thư viện Python - Câu hỏi phỏng vấn Python

Q84. Giải thích bình là gì và lợi ích của nó?

ANS: & NBSP; Flask là một máy tính vi mô web cho Python dựa trên giấy phép của Werkzeug, jinja2 và ý định tốt của BSD BSD. Werkzeug và Jinja2 là hai trong số các phụ thuộc của họ. Điều này có nghĩa là nó sẽ có rất ít hoặc không có sự phụ thuộc vào các thư viện bên ngoài. & NBSP; Nó làm cho khung ánh sáng trong khi có một chút phụ thuộc để cập nhật và ít lỗi bảo mật hơn. Flask is a web microframework for Python based on “Werkzeug, Jinja2 and good intentions” BSD license. Werkzeug and Jinja2 are two of their dependencies. This means it will have little to no dependencies on external libraries.  It makes the framework light while there is a little dependency to update and fewer security bugs. Flask is a web microframework for Python based on “Werkzeug, Jinja2 and good intentions” BSD license. Werkzeug and Jinja2 are two of their dependencies. This means it will have little to no dependencies on external libraries.  It makes the framework light while there is a little dependency to update and fewer security bugs. Flask is a web microframework for Python based on “Werkzeug, Jinja2 and good intentions” BSD license. Werkzeug and Jinja2 are two of their dependencies. This means it will have little to no dependencies on external libraries.  It makes the framework light while there is a little dependency to update and fewer security bugs.

Một phiên về cơ bản cho phép bạn nhớ thông tin từ yêu cầu này sang yêu cầu khác. Trong bình, một phiên sử dụng cookie đã ký để người dùng có thể xem nội dung phiên và sửa đổi chúng. Người dùng có thể sửa đổi phiên nếu chỉ có bình khóa bí mật.secret_key.

Q85. Django có tốt hơn bình không?

Trả lời: & nbsp; django và flask ánh xạ URL hoặc địa chỉ được nhập vào các trình duyệt web để các chức năng trong Python. & NBSP; Django and Flask map the URL’s or addresses typed in the web browsers to functions in Python.  Django and Flask map the URL’s or addresses typed in the web browsers to functions in Python.  Django and Flask map the URL’s or addresses typed in the web browsers to functions in Python. 

Flask đơn giản hơn nhiều so với Django, nhưng, Flask không làm gì nhiều cho bạn có nghĩa là bạn sẽ cần chỉ định các chi tiết, trong khi Django làm rất nhiều cho bạn trong khi bạn không cần phải làm nhiều việc. Django bao gồm mã viết sẵn, mà người dùng sẽ cần phân tích trong khi bình cung cấp cho người dùng để tạo mã của riêng họ, do đó, giúp việc hiểu mã đơn giản hơn. Về mặt kỹ thuật, cả hai đều tốt như nhau và cả hai đều chứa ưu và nhược điểm của riêng họ.

Q86. Đề cập đến sự khác biệt giữa Django, kim tự tháp và bình.

Ans:    

  • Flask là một bộ phim vi mô của người Viking chủ yếu xây dựng cho một ứng dụng nhỏ với các yêu cầu đơn giản hơn. Trong bình, bạn phải sử dụng các thư viện bên ngoài. Bình đã sẵn sàng để sử dụng.
  • Kim tự tháp được xây dựng cho các ứng dụng lớn hơn. Nó cung cấp sự linh hoạt và cho phép nhà phát triển sử dụng các công cụ phù hợp cho dự án của họ. Nhà phát triển có thể chọn cơ sở dữ liệu, cấu trúc URL, kiểu khuôn mẫu và nhiều hơn nữa. Kim tự tháp có cấu hình nặng.
  • Django cũng có thể được sử dụng cho các ứng dụng lớn hơn giống như kim tự tháp. Nó bao gồm một orm.

Q87. Thảo luận về kiến ​​trúc Django.. Discuss Django architecture.

ANS: & NBSP; Django MVT mẫu: Django MVT Pattern: Django MVT Pattern: Django MVT Pattern:

Hướng dẫn python coding problems - vấn đề mã hóa python

Hình: & NBSP; & NBSP; Câu hỏi phỏng vấn Python - Kiến trúc Django  Python Interview Questions – Django Architecture  Python Interview Questions – Django Architecture  Python Interview Questions – Django Architecture

Nhà phát triển cung cấp mô hình, chế độ xem và mẫu sau đó chỉ ánh xạ nó vào URL và Django thực hiện phép thuật để phục vụ nó cho người dùng.

Q88. Giải thích cách bạn có thể thiết lập cơ sở dữ liệu trong Django.

Trả lời: & nbsp; bạn có thể sử dụng lệnh chỉnh sửa mysite/settings.py, đó là một mô -đun Python bình thường với cấp độ mô -đun đại diện cho cài đặt Django. You can use the command edit mysite/setting.py, it is a normal python module with module level representing Django settings. You can use the command edit mysite/setting.py, it is a normal python module with module level representing Django settings. You can use the command edit mysite/setting.py, it is a normal python module with module level representing Django settings.

Django sử dụng sqlite theo mặc định; Thật dễ dàng cho người dùng Django vì nó đã giành được bất kỳ loại cài đặt nào khác. Trong trường hợp, lựa chọn cơ sở dữ liệu của bạn khác rằng bạn phải có các khóa sau trong & NBSP; Cơ sở dữ liệu ‘mặc định & NBSP; mục để phù hợp với cài đặt kết nối cơ sở dữ liệu của bạn.

  • Động cơ: Bạn có thể thay đổi cơ sở dữ liệu bằng cách sử dụng 'django.db.backends.sqlite3', 'django.db.backeneds.mysql', 'django.db.backends.postgresql_psycopg2' trên: you can change the database by using ‘django.db.backends.sqlite3’ , ‘django.db.backeneds.mysql’, ‘django.db.backends.postgresql_psycopg2’, ‘django.db.backends.oracle’ and so on: you can change the database by using ‘django.db.backends.sqlite3’ , ‘django.db.backeneds.mysql’, ‘django.db.backends.postgresql_psycopg2’, ‘django.db.backends.oracle’ and so on: you can change the database by using ‘django.db.backends.sqlite3’ , ‘django.db.backeneds.mysql’, ‘django.db.backends.postgresql_psycopg2’, ‘django.db.backends.oracle’ and so on
  • Tên: Tên của cơ sở dữ liệu của bạn. Trong trường hợp nếu bạn đang sử dụng SQLite làm cơ sở dữ liệu của mình, trong trường hợp đó, cơ sở dữ liệu sẽ là một tệp trên máy tính của bạn, tên phải là một đường dẫn tuyệt đối đầy đủ, bao gồm tên tệp của tệp đó.: The name of your database. In the case if you are using SQLite as your database, in that case, database will be a file on your computer, Name should be a full absolute path, including the file name of that file.: The name of your database. In the case if you are using SQLite as your database, in that case, database will be a file on your computer, Name should be a full absolute path, including the file name of that file.: The name of your database. In the case if you are using SQLite as your database, in that case, database will be a file on your computer, Name should be a full absolute path, including the file name of that file.
  • Nếu bạn không chọn SQLite làm cơ sở dữ liệu của mình thì các cài đặt như mật khẩu, máy chủ, người dùng, v.v.

Django sử dụng SQLite làm cơ sở dữ liệu mặc định, nó lưu trữ dữ liệu dưới dạng một tệp duy nhất trong hệ thống tập tin. Nếu bạn có một máy chủ cơ sở dữ liệu, Postgresql, MySQL, Oracle, MSSQL, và muốn sử dụng nó thay vì SQLite, thì hãy sử dụng các công cụ quản trị cơ sở dữ liệu của bạn để tạo cơ sở dữ liệu mới cho dự án Django của bạn. Dù bằng cách nào, với cơ sở dữ liệu (trống) của bạn tại chỗ, tất cả những gì còn lại là nói với Django cách sử dụng nó. Đây là nơi tập tin cài đặt dự án của bạn.

Chúng tôi sẽ thêm các dòng mã sau vào tệp cài đặt.py:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
27

Q89. Cho một ví dụ làm thế nào bạn có thể viết một chế độ xem trong Django?

Trả lời: & nbsp; Đây là cách chúng ta có thể sử dụng Viết một chế độ xem trong Django: This is how we can use write a view in Django: This is how we can use write a view in Django: This is how we can use write a view in Django:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
28

Trả về ngày và giờ hiện tại, dưới dạng tài liệu HTML

Q90. Đề cập đến những gì các mẫu Django bao gồm.

Ans: & nbsp; mẫu là một tệp văn bản đơn giản. & Nbsp; Nó có thể tạo bất kỳ định dạng dựa trên văn bản như XML, CSV, HTML, v.v. & NBSP; Một mẫu chứa các biến được thay thế bằng các giá trị khi mẫu được đánh giá và thẻ ( % thẻ %) kiểm soát logic của mẫu. The template is a simple text file.  It can create any text-based format like XML, CSV, HTML, etc.  A template contains variables that get replaced with values when the template is evaluated and tags (% tag %) that control the logic of the template. The template is a simple text file.  It can create any text-based format like XML, CSV, HTML, etc.  A template contains variables that get replaced with values when the template is evaluated and tags (% tag %) that control the logic of the template. The template is a simple text file.  It can create any text-based format like XML, CSV, HTML, etc.  A template contains variables that get replaced with values when the template is evaluated and tags (% tag %) that control the logic of the template.

Hình: & NBSP; Câu hỏi phỏng vấn Python - Mẫu DjangoPython Interview Questions – Django TemplatePython Interview Questions – Django TemplateQ91. Giải thích việc sử dụng phiên trong khung Django?Python Interview Questions – Django Template

Q91. Giải thích việc sử dụng phiên trong khung Django?

ANS: & NBSP; Django cung cấp một phiên cho phép bạn lưu trữ và truy xuất dữ liệu trên cơ sở người truy cập trên mỗi trang web. Django tóm tắt quá trình gửi và nhận cookie, bằng cách đặt cookie ID phiên ở phía máy khách và lưu trữ tất cả các dữ liệu liên quan ở phía máy chủ. Django provides a session that lets you store and retrieve data on a per-site-visitor basis. Django abstracts the process of sending and receiving cookies, by placing a session ID cookie on the client side, and storing all the related data on the server side. Django provides a session that lets you store and retrieve data on a per-site-visitor basis. Django abstracts the process of sending and receiving cookies, by placing a session ID cookie on the client side, and storing all the related data on the server side. Django provides a session that lets you store and retrieve data on a per-site-visitor basis. Django abstracts the process of sending and receiving cookies, by placing a session ID cookie on the client side, and storing all the related data on the server side.

Hình: Câu hỏi phỏng vấn Python - Khung DjangoPython Interview Questions – Django FrameworkPython Interview Questions – Django FrameworkPython Interview Questions – Django Framework

Vì vậy, chính dữ liệu không được lưu trữ phía máy khách. Điều này là tốt đẹp từ góc độ bảo mật.

Q92. & NBSP; Liệt kê các phong cách thừa kế trong Django.List out the inheritance styles in Django.List out the inheritance styles in Django.List out the inheritance styles in Django.

Ans: & nbsp; Trong Django, có ba kiểu thừa kế có thể: In Django, there are three possible inheritance styles: In Django, there are three possible inheritance styles: In Django, there are three possible inheritance styles:

  1. Các lớp cơ sở trừu tượng: Phong cách này được sử dụng khi bạn chỉ muốn lớp cha mẹ giữ thông tin mà bạn không muốn gõ cho từng mô hình con.
  2. Kế thừa đa bàn: Kiểu này được sử dụng nếu bạn đang phân loại một mô hình hiện có và cần mỗi mô hình để có bảng cơ sở dữ liệu riêng.
  3. Các mô hình proxy: & nbsp; bạn có thể sử dụng mô hình này, nếu bạn chỉ muốn sửa đổi hành vi cấp độ Python của mô hình, mà không thay đổi các trường mô hình.

Tiếp theo trong blog câu hỏi phỏng vấn Python này, hãy để xem các câu hỏi liên quan đến việc cạo web

Quét web - Câu hỏi phỏng vấn Python

Q93. Làm thế nào để lưu một hình ảnh cục bộ bằng Python có địa chỉ URL mà tôi đã biết?

Trả lời: & nbsp; chúng tôi sẽ sử dụng mã sau để lưu hình ảnh cục bộ khỏi địa chỉ URL We will use the following code to save an image locally from an URL address We will use the following code to save an image locally from an URL address We will use the following code to save an image locally from an URL address

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
29

Q94. Làm thế nào bạn có thể nhận được tuổi bộ nhớ cache của Google của bất kỳ URL hoặc trang web nào?

Ans: & nbsp; Sử dụng định dạng URL sau: Use the following URL format: Use the following URL format: Use the following URL format:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
15

Hãy chắc chắn thay thế Urlgoeshere trực tiếp bằng địa chỉ web thích hợp của trang hoặc trang web có bộ đệm mà bạn muốn truy xuất và xem thời gian. Ví dụ: để kiểm tra Google Webcache Age of Edureka.co, bạn đã sử dụng URL sau:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
16

a = lambda x,y : x+y print(a(5, 6)) 1Q95. Bạn được yêu cầu loại bỏ dữ liệu từ trang 250 phim Top IMDB. Nó chỉ nên có tên phim, năm và xếp hạng.Q95. You are required to scrap data from IMDb top 250 movies page. It should only have fields movie name, year, and rating.

Trả lời: & nbsp; Chúng tôi sẽ sử dụng các dòng mã sau: We will use the following lines of code: We will use the following lines of code: We will use the following lines of code:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
0

Mã trên sẽ giúp dữ liệu phế liệu từ danh sách Top 250 của IMDB

Tiếp theo trong blog Câu hỏi phỏng vấn Python này, hãy để Lôi xem các câu hỏi liên quan đến phân tích dữ liệu trong Python.

Phân tích dữ liệu - Câu hỏi phỏng vấn Python

Q96. Chức năng bản đồ trong Python là gì?

ANS: & NBSP; Hàm MAP thực thi hàm được đưa ra là đối số đầu tiên trên tất cả các yếu tố của điều kiện được đưa ra dưới dạng đối số thứ hai. Nếu hàm được đưa ra trong hơn 1 đối số, thì nhiều lần lặp được đưa ra. #Follow liên kết để biết nhiều chức năng tương tự hơn. map function executes the function given as the first argument on all the elements of the iterable given as the second argument. If the function given takes in more than 1 arguments, then many iterables are given. #Follow the link to know more similar functions. map function executes the function given as the first argument on all the elements of the iterable given as the second argument. If the function given takes in more than 1 arguments, then many iterables are given. #Follow the link to know more similar functions. map function executes the function given as the first argument on all the elements of the iterable given as the second argument. If the function given takes in more than 1 arguments, then many iterables are given. #Follow the link to know more similar functions.

Q97. Python numpy có tốt hơn danh sách không?

Ans: & nbsp; Chúng tôi sử dụng mảng Python numpy thay vì một danh sách vì ba lý do dưới đây: We use python numpy array instead of a list because of the below three reasons: We use python numpy array instead of a list because of the below three reasons: We use python numpy array instead of a list because of the below three reasons:

  1. Ít bộ nhớ hơn
  2. Nhanh
  3. Tiện lợi

Để biết thêm thông tin về các tham số này, bạn có thể tham khảo phần này - danh sách Numpy VS.

Q98. Làm thế nào để có được các chỉ số của n giá trị tối đa trong một mảng numpy?

Trả lời: & nbsp; chúng ta có thể nhận các chỉ số của n giá trị tối đa trong một mảng numpy bằng cách sử dụng mã dưới đây: We can get the indices of N maximum values in a NumPy array using the below code: We can get the indices of N maximum values in a NumPy array using the below code: We can get the indices of N maximum values in a NumPy array using the below code:

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
1

Đầu ra

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
2

Q99. Làm thế nào để bạn tính toán phần trăm với python/ numpy?

Ans: & nbsp; chúng tôi có thể tính toán phần trăm với mã sau We can calculate percentiles with the following code We can calculate percentiles with the following code We can calculate percentiles with the following code

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
3
import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
11Output:3Output:3Output:3Output:3

Q100. Sự khác biệt giữa Numpy và Scipy là gì?

Ans:

Numpy Scipy
Nó đề cập đến Python số. Nó đề cập đến Python khoa học.
Nó có ít tính năng điện toán khoa học mới hơn.scientific computing features.scientific computing features.scientific computing features. Hầu hết các tính năng điện toán khoa học mới thuộc về Scipy.
Nó chứa ít các hàm đại số tuyến tính.linear algebra functions.linear algebra functions.linear algebra functions. Nó có các phiên bản đầy đủ tính năng của các mô-đun đại số tuyến tính, cũng như nhiều thuật toán số khác.fully-featured versions of the linear algebra modules, as well as many other numerical algorithms.fully-featured versions of the linear algebra modules, as well as many other numerical algorithms.fully-featured versions of the linear algebra modules, as well as many other numerical algorithms.
Numpy có tốc độ xử lý nhanh hơn. Mặt khác, Scipy có tốc độ tính toán chậm hơn.

Q101. Làm thế nào để bạn thực hiện các lô/trực quan hóa 3D bằng Numpy/Scipy?

Trả lời: & nbsp; như âm mưu 2D, đồ họa 3D nằm ngoài phạm vi của Numpy và Scipy, nhưng cũng giống như trong trường hợp 2D, các gói tồn tại tích hợp với Numpy. & NBSP; ; Like 2D plotting, 3D graphics is beyond the scope of NumPy and SciPy, but just as in the 2D case, packages exist that integrate with NumPy. Matplotlib provides basic 3D plotting in the mplot3d subpackage, whereas Mayavi provides a wide range of high-quality 3D visualization features, utilizing the powerful VTK engine. Like 2D plotting, 3D graphics is beyond the scope of NumPy and SciPy, but just as in the 2D case, packages exist that integrate with NumPy. Matplotlib provides basic 3D plotting in the mplot3d subpackage, whereas Mayavi provides a wide range of high-quality 3D visualization features, utilizing the powerful VTK engine. Like 2D plotting, 3D graphics is beyond the scope of NumPy and SciPy, but just as in the 2D case, packages exist that integrate with NumPy. Matplotlib provides basic 3D plotting in the mplot3d subpackage, whereas Mayavi provides a wide range of high-quality 3D visualization features, utilizing the powerful VTK engine.

Tiếp theo trong blog câu hỏi phỏng vấn Python này, hãy để xem một số MCQs

Câu hỏi trắc nghiệm (MCQ) - Câu hỏi phỏng vấn PythonPython Interview Questions

Q102. Phát biểu nào sau đây tạo ra một từ điển? (Nhiều câu trả lời đúng có thể)

a) d = {} b) d = {Hồi John,: 40, Hồi Peter, 45} c) d = {40: Hồi John, 45: , 45: b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) d = (40:”john”, 45:”50”)

Trả lời: B, C & D. & NBSP;b, c & d. b, c & d. b, c & d. 

Từ điển được tạo bằng cách chỉ định các khóa và giá trị.

Q103. Cái nào trong số đó là phân chia sàn?

a) / b) // c) % d) không có ai trong số những người được đề cập b) // c) % d) None of the mentioned

Trả lời: b) //b) //b) //b) //

Khi cả hai toán hạng đều là số nguyên thì Python cắt phần phân số và cung cấp cho bạn giá trị làm tròn, để có được câu trả lời chính xác sử dụng phân chia sàn. Đối với Ex, 5/2 = 2.5 nhưng cả hai toán hạng đều là số nguyên, vì vậy, câu trả lời của biểu thức này trong Python là 2. Để có được 2.5 làm câu trả lời, hãy sử dụng phân chia sàn bằng cách sử dụng //. Vì vậy, 5 // 2 = 2.5

Q104. Độ dài tối đa có thể của một định danh là gì?

a) 31 ký tự b) 63 ký tự c) 79 ký tự d) không có ký tự nào ở trên b) 63 characters c) 79 characters d) None of the above b) 63 characters c) 79 characters d) None of the above
b) 63 characters
c) 79 characters
d) None of the above

Trả lời: D) Không có điều nào ở trênd) None of the aboved) None of the aboved) None of the above

Định danh có thể có bất kỳ độ dài nào.

Q105. Tại sao các tên biến cục bộ bắt đầu với một dấu gạch dưới không được khuyến khích?

a) Chúng được sử dụng để chỉ ra một biến riêng của lớp B) Chúng nhầm lẫn với trình thông dịch c) Chúng được sử dụng để chỉ ra các biến toàn cầu d) chúng làm chậm quá trình thực thi b) they confuse the interpreter c) they are used to indicate global variables d) they slow down execution b) they confuse the interpreter c) they are used to indicate global variables d) they slow down execution
b) they confuse the interpreter
c) they are used to indicate global variables
d) they slow down execution

Trả lời: a) Chúng được sử dụng để chỉ ra một biến riêng của một lớpa) they are used to indicate a private variable of a classa) they are used to indicate a private variable of a classa) they are used to indicate a private variable of a class

Vì Python không có khái niệm về các biến riêng tư, các dấu gạch dưới được sử dụng để chỉ ra các biến không được truy cập từ bên ngoài lớp.

Q106. Điều nào sau đây là một tuyên bố không hợp lệ?

A) ABC = 1.000.000 B) A B C = 1000 2000 3000 C) A, B, C = 1000, 2000, 3000 D) A_B_C = 1.000.000 b) a b c = 1000 2000 3000 c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,000,000 b) a b c = 1000 2000 3000 c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000

Trả lời: B) A B C = 1000 2000 3000b) a b c = 1000 2000 3000b) a b c = 1000 2000 3000b) a b c = 1000 2000 3000

Không gian không được phép trong các tên biến.

Q107. Đầu ra của những điều sau đây là gì?

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
4

a) một số người đã xảy ra b) someError has not occured c) invalid code d) none of the above

Trả lời: C) & NBSP; Mã không hợp lệc) invalid codec) invalid codec) invalid code

Một lớp ngoại lệ mới phải thừa hưởng từ một baseexception. Không có sự thừa kế như vậy ở đây.

Q108. Giả sử list1 là [2, 33, 222, 14, 25], list1 [-1] là gì?

A) Lỗi b) Không C) 25 D) 2 b) None c) 25 d) 2 b) None c) 25 d) 2
b) None
c) 25
d) 2

Trả lời: C) 25c) 25c) 25c) 25

Chỉ mục -1 tương ứng với chỉ mục cuối cùng trong danh sách.

Q109. Để mở tệp C: điểm.txt để viết, chúng tôi sử dụng

A) Outfile = Open (Cấm C: SCORE.TXT, Tiết,, R R R) b) outfile = open(“c:scores.txt”, “w”) c) outfile = open(file = “c:scores.txt”, “r”) d) outfile = open(file = “c:scores.txt”, “o”) b) outfile = open(“c:scores.txt”, “w”) c) outfile = open(file = “c:scores.txt”, “r”) d) outfile = open(file = “c:scores.txt”, “o”)
b) outfile = open(“c:scores.txt”, “w”)
c) outfile = open(file = “c:scores.txt”, “r”)
d) outfile = open(file = “c:scores.txt”, “o”)

Trả lời: b) & nbsp; vị trí chứa dấu gạch chéo đôi () và w được sử dụng để & nbsp; chỉ ra rằng tệp đang được & nbsp; được viết.b) The location contains double slashes ( ) and w is used to indicate that file is being written to.b) The location contains double slashes ( ) and w is used to indicate that file is being written to.b) The location contains double slashes ( ) and w is used to indicate that file is being written to.

Q110. Đầu ra của những điều sau đây là gì?

import array as arr
My_Array=arr.array('i',[1,2,3,4])
My_list=[1,'abc',1.20]
print(My_Array)
print(My_list)
5

a) TrueB) falsec) không) lỗi b) False c) None d) Error

Trả lời: a) Đúng & nbsp;a) True a) True a) True 

Tuyên bố với câu lệnh khi được sử dụng với tệp mở đảm bảo rằng đối tượng tệp được đóng khi khối có thoát.

Q111. Khi nào thì phần khác của Try-Except-Else sẽ được thực thi?

a) luôn luôn) khi xảy ra ngoại lệ) khi không xảy ra ngoại lệ) khi xảy ra ngoại lệ b) when an exception occurs c) when no exception occurs d) when an exception occurs into except block

Trả lời: c) Khi không xảy ra ngoại lệc) when no exception occursc) when no exception occursc) when no exception occurs

Phần khác được thực thi khi không xảy ra ngoại lệ.

Tôi hy vọng bộ Python & NBSP; Câu hỏi phỏng vấn sẽ giúp bạn chuẩn bị cho các cuộc phỏng vấn của bạn. Tất cả tốt nhất!

Có một câu hỏi cho chúng tôi? Vui lòng đề cập đến nó trong phần bình luận và chúng tôi sẽ liên hệ lại với bạn sớm nhất.

Nếu bạn muốn học Python và có được chuyên môn trong phân tích định lượng, khai thác dữ liệu và trình bày dữ liệu để xem các con số bằng cách biến sự nghiệp của bạn thành vai trò của nhà khoa học dữ liệu, hãy xem đào tạo chứng nhận Python tương tác, trực tuyến của chúng tôi. Ngoài ra, chúng tôi cung cấp một khoa học dữ liệu với khóa học Python sẽ giúp bạn làm chủ nghệ thuật phân tích và kỹ thuật khoa học dữ liệu sử dụng Python. Bạn sẽ sử dụng các thư viện như gấu trúc, numpy, matplotlib, scipy, scikit và pyspark và làm chủ các khái niệm như học máy Python, tập lệnh, trình tự, quét web và phân tích dữ liệu lớn thúc đẩy Apache Spark. Huấn luyện Python của chúng tôi về Chennai & NBSP; đi kèm với hỗ trợ 24*7 để hướng dẫn bạn trong suốt thời gian học tập của bạn.

Tôi có thể bẻ khóa cuộc phỏng vấn mã hóa với Python không?

Có. Với chiến lược đúng đắn, bạn có thể đánh giá các câu hỏi phỏng vấn mã hóa Python với 3 tháng chuẩn bị.Thực hành của bạn nên được tập trung vào các vấn đề về cấu trúc dữ liệu cốt lõi và thuật toán.With the right strategy, you can ace Python coding interview questions with 3 months of preparation. Your practice should be centered on problems on core data structures and algorithms.With the right strategy, you can ace Python coding interview questions with 3 months of preparation. Your practice should be centered on problems on core data structures and algorithms. With the right strategy, you can ace Python coding interview questions with 3 months of preparation. Your practice should be centered on problems on core data structures and algorithms.

Làm cách nào để thực hành phỏng vấn lập trình Python?

Phỏng vấn mã hóa Python: Mẹo & Thực tiễn tốt nhất....

Sử dụng Enumerate () để lặp lại cả chỉ số và giá trị ..

Gỡ lỗi mã có vấn đề với điểm dừng ().

Chuỗi định dạng hiệu quả với dây F ..

Sắp xếp danh sách với các đối số tùy chỉnh ..

Sử dụng máy phát điện thay vì danh sách toàn diện để bảo tồn bộ nhớ ..