10-码蹄集600题基础python篇

10-码蹄集600题基础python篇_第1张图片

题目如上:

这题就是ASCII的转换,直接使用ord就可以

下面是代码:


def main():
    #code here
    # a1,a2=input().split(",")
    # print(f"The ASCII code of {a1} is {ord(a1)}")
    # print(f"The ASCII code of {a2} is {ord(a2)}")
    A,B=input().split(",")
    print(f"The ASCII code of {A} is {ord(A)}")
    print(f"The ASCII code of {B} is {ord(B)}")
if __name__ == '__main__':
    main()

注释的是第一遍做的,可以成功运行。这里主要是注意 is后面有一个空格。我就是没注意空格,最后运行报错的。请小伙伴们注意!

你可能感兴趣的:(python,java,前端,码蹄集)