python實現單條及用戶指定條橫線的打印——函數


#打印一條線
def hengxian():
print("-"*30)
hengxian()

 
        
#打印用戶指定條橫線
def hengxian():
print("-"*30)

# hengxian()
#多的東西要想到循環
# def duotiaohengxian(x):
# print(hengxian() * x)
# a = int(input("請輸入打印次數"))
# duotiaohengxian(a)

def duotiao(x):
for i in range(0,x):
hengxian()
a = int(input("請輸入橫線條數:"))
duotiao(a)

 

 

 
 

 



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM