题库首页 › GESP等级认证(Python) › 题目 20670

对如下定义的循环单链表,`print_list` 函数横线处填写()。class Node: def __init__ (self , data) : self.data = data self.next = None def create_list(value) : head = Node(value) head.next = head return head def insert_tail(head , value) : p = head while p.next != head: p = p.next node = Node(value) node.next = head p.next = node def print_list(head) : # 填空位置 while True: print(p.data , end=" ") p = p.next if p == head : break print()

A. if head is None: return p.next = head
B. if head is None: return p = head.next
C. if head is None: return p = head
D. if head.next is None: return p = head

正确答案:C

试卷来源:202512 CCF-GESP编程能力等级认证Python五级真题

本卷相关题目

在线做题 同科目题库