2017-05-25 57 views
-2

我的教授希望我们的代码包含一个源代码头,我不知道该把它放在哪里。我究竟在哪里放置源代码头?

#!/usr/bin/env python3 
# -*- coding: utf-8 -*- 
""" 
Created on Mon May 22 21:31:16 2017 

@author: noraasrar 
""" 
# Code starts here 

的源代码头看起来是这样的:

########################################################### 
# Computer Project #5 
# 
# Algorithm 
# prompt for an integer 
# input an integer 
# loop while not end-of-data 
#  call function to count number of digits in integer 
#  output the number of digits 
#  prompt for an integer 
#  input an integer 
# display closing message 
########################################################### 
+2

把它放在你的教授要你把它。 – user2357112

+0

把它放在你把作者放在哪里? – Skycc

回答

1

唯一真正的“限购”的地方,你可以把那就是前两行的家当和行声明编码下方。第一行帮助您的操作系统确定如何执行该文件,第二行tells the Python executable what file encoding to use when it reads the script

由于“源代码头”只是一个注释块,这可能会工作:

#!/usr/bin/env python3 
# -*- coding: utf-8 -*- 
""" 
Created on Mon May 22 21:31:16 2017 

@author: noraasrar 
""" 
########################################################### 
# Computer Project #5 
# 
# Algorithm 
# prompt for an integer 
# input an integer 
# loop while not end-of-data 
#  call function to count number of digits in integer 
#  output the number of digits 
#  prompt for an integer 
#  input an integer 
# display closing message 
########################################################### 
# Code starts here