我分别编写了这个任务的两个部分,它们按预期运行。当我组合这些部分时,程序将只运行第一个方法调用(drawBox)并忽略第二个方法(drawPattern)。我做错了什么?
>>> s2f = s2f.ljust(get_multiples(s2f), '_')
答案 0 :(得分:0)
这很完美。您只需输入3 int值。我用三个10运行它,结果是这样的:
Enter the number of boxes desired:10
+------+------+------+------+------+------+------+------+------+------+
| | | | | | | | | | |
| | | | | | | | | | |
+------+------+------+------+------+------+------+------+------+------+
Enter width of the pattern:10
Enter height of the pattern:10
__ __ __ __ __ __ __ __ __ __
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__
\__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
这不应该像这样工作吗?
答案 1 :(得分:0)
当我输入非整数值时,我的机器上的两个都运行正常。我假设这是预期的结果:
Connected to the target VM, address: '127.0.0.1:41443', transport: 'socket'
Project 1 written by CHRISTOPHER TERRANOVA
Enter the number of boxes desired:
3
+------+------+------+
| | | |
| | | |
+------+------+------+
Enter width of the pattern:
3
Enter height of the pattern:
3
Disconnected from the target VM, address: '127.0.0.1:41443', transport: 'socket'
__ __ __
/ \__/ \__/ \__
\__/ \__/ \__/
/ \__/ \__/ \__
\__/ \__/ \__/
/ \__/ \__/ \__
\__/ \__/ \__/
Process finished with exit code 0