用python回答sos?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用python回答sos?相关的知识,希望对你有一定的参考价值。

# 试题4:已知字符串列表A,包含初始数据:a1,a2,a3,a4,a5;字符串列表B,包含初始数据:b1,b2,b3,b4,b5。编写程序将数组A、B的每一对应数据项相连接,然后存入字符串列表C,并输出数组C。输出结果为:a1b1,a2b2,a3b3,a4b4,a5b5。
# 例如:列表A的值为[“Hello ” , “Hello ” , “Hello ” , “Hello ” , “Hello ” ],数组B的值为[“Jack” , “Tom” , “Lee” , “John” , “Alisa”],则输出结果为[“Hello Jack” , “Hello Tom” , “Hello Lee” , “Hello John” , “Hello Alisa” ]。
# 要求:
# l 定义2个字符串列表A、B,用于存储初始数据。定义列表C,用于输出结果。
# l 使用循环将列表A、B的对应项相连接,结果存入列表C。(不要边连接边输出)
# l 使用循环将列表C中的值按顺序输出。

参考技术A

                                                                  

也可以直接在for中写成C.append(A[i]+" "+B[i]),在连接的时候两个数组中间加个空格,显示起来好看点。如果不需要分开一点,可以改成C.append(A[i]+B[i])就可以啦

参考技术B 主要考察python简单的字符串和列表操作。 参考技术C Unsupported image object 估计是你的png内容不规范。。。
先规范下格式再用吧。
Image.open(r'F://work//test//python//222.png').save("222.png")
img = Image.open("222.png")
vcode = pytesseract.image_to_string(img)
# draw a circle on top of two rectangles
# using module graphics from:
# http://mcsp.wartburg.edu/zelle/python/graphics.py

from graphics import *

# create the window/frame
w = 300
h = 300
win = GraphWin("Red Circle", w, h)

# first rectangle using corner x, y coordinates
upper_left = Point(0, 0)
lower_right = Point(300, 150)
rect1 = Rectangle(upper_left, lower_right)
rect1.setFill('yellow')
rect1.setWidth(0) # no border
rect1.draw(win)

# second rectangle using corner x, y coordinates
upper_left = Point(0, 150)
lower_right = Point(300, 300)
rect2 = Rectangle(upper_left, lower_right)
rect2.setFill('green')
rect2.setWidth(0) # no border
rect2.draw(win)

# circle needs center x, y coordinates and radius
center = Point(150, 150)
radius = 80
circle = Circle(center, radius)
circle.setFill('red')
circle.setWidth(2)
circle.draw(win)

# wait, click mouse to go on/exit
win.getMouse()
win.close()。希望我的回答能够帮助您,还望采纳。

以上是关于用python回答sos?的主要内容,如果未能解决你的问题,请参考以下文章

用 Vim 写 Python 的最佳实践

用python+selenium抓取知乎今日最热和本月最热的前三个问题及每个问题的首个回答并保存至html文件

python线程间通信的问题,回答有加分!300

用pyton回答请输入3个小数,用print()函输出3个数,数之间用逗号分隔?

Python 图中的while循环改for循环,怎么改,直接回答代码,谢谢

python3+selenium百度知道回答问题输入框这个元素定位不到,求方法 解决了肯定高悬赏加采纳?