小编Bea*_*ver的帖子

Python中的ASCII艺术

我对python很陌生,把它当作一种爱好兴趣,并通过一些搜索发现自己是一堆来自" 计算实践 " 的练习,其中一个要求写一个ASCII数字,如下所示.

ascii十字架

这一切似乎都是一个足够简单的练习,但我似乎无法用一个数字来描绘这个,练习说明上面的绘图是通过使用数字"1"绘制的.

它还指出,不能或不应使用0或100以上的数字来创建ASCII绘图.

这是另一个例子:

这里的输入是数字"2".

更大的ascii十字架

我找到了一种方法来显示第一个图像,但不是通过任何方式使用给定的数字,只是在while循环中的一个简单的"else",所以我可以过滤掉低于或等于0的数字并且高于或等于100.

我已经死了.

我的代码如上所述,不使用变量编号来创建第一个图:

while True:
s = input("Give me a number to make a drawing with that is between 0 and 100: ")


if not s.isdigit():
    print ("Error, only numbers will make this program run.")
    continue #Try Again but with a number this time

if int(s) >= 100:
    print ("The number is bigger than or equal to 100 and won't work. \nDo try again.")
    continue #try again

if int(s) <= 0: …
Run Code Online (Sandbox Code Playgroud)

python ascii

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

ascii ×1

python ×1