V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
deltadawn
V2EX  ›  Python

Python 题目不会做,请教大神解题

  •  
  •   deltadawn · Aug 23, 2022 · 4178 views
    This topic created in 1349 days ago, the information mentioned may be changed or developed.

    如图

    20 replies    2022-08-23 23:06:25 +08:00
    Whateveraname
        1
    Whateveraname  
       Aug 23, 2022
    图哪
    lllllliiii
        2
    lllllliiii  
       Aug 23, 2022
    找个班上吧,图片是什么浙江高二期中考试的题目 @Whateveraname
    deltadawn
        3
    deltadawn  
    OP
       Aug 23, 2022
    不好意思,不会发图,![图]( https://imgur.com/a/6eyjNLL)
    JasonLaw
        4
    JasonLaw  
       Aug 23, 2022 via iPhone
    if __name__ == '__main__':
    s = 'w3y5'

    res = ''

    i = 0
    while i < len(s):
    c = s[i]
    j = i + 1
    while j < len(s) and s[j].isnumeric():
    j += 1
    count = int(s[i + 1:j])
    for _ in range(count):
    res += c
    i = j

    print(res)
    asd7160
        5
    asd7160  
       Aug 23, 2022
    ……高中生来这里白嫖作业题答案嘛
    JasonEWNL
        6
    JasonEWNL  
       Aug 23, 2022
    (1)

    www

    (2)

    10 * n + int(ch)
    result += n * s1
    i += 1

    ```python
    s = input('data: ') + ' . '
    n = 0
    result = ''
    s1 = s[0]
    i = 1
    while i <= len(s) - 1:
    ch = s[i]
    if ch >= '0' and ch <= '9':
    n = 10 * n + int(ch)
    else:
    result += n * s1
    s1 = ch
    n = 0
    i += 1 # 原题缩进有问题
    print(result)
    ```

    忠告,如果是学生,自己的作业自己做。
    Leviathann
        7
    Leviathann  
       Aug 23, 2022
    原来还能这么出题。。
    开眼了
    Geekgogo
        8
    Geekgogo  
       Aug 23, 2022
    高中考 python ?😺
    Latin
        9
    Latin  
       Aug 23, 2022
    @JasonEWNL 10*n 无意义 n 本来就是 0 直接 int(ch)
    Noicdi
        10
    Noicdi  
       Aug 23, 2022 via iPhone
    @Geekgogo #8 开眼界了
    JasonEWNL
        11
    JasonEWNL  
       Aug 23, 2022
    @Latin 原题说「数字可以是多位」,所以需要累计,可以用 `w13y5` 测试一下区别。
    lisongeee
        12
    lisongeee  
       Aug 23, 2022
    1. 楼主发的是图片的预览链接,不是图的链接
    2. V2EX 评论会吃代码空格缩进,python 代码发出来基本都用语法错误
    3. 图在这里下面

    ![img]( )
    lisongeee
        13
    lisongeee  
       Aug 23, 2022
    好像是图片有防盗链?我发原图链接也不行
    Latin
        14
    Latin  
       Aug 23, 2022
    @JasonEWNL 审题错误 odkk
    maxbon
        15
    maxbon  
       Aug 23, 2022   ❤️ 1
    现在这么卷了吗,高中就考 python 了吗
    ysc3839
        16
    ysc3839  
       Aug 23, 2022
    @deltadawn @lisongeee
    imgur 要发 i.imgur.com 那个链接,imgur.com 返回的是网页(text/html)而不是图片,自然显示不出
    sobev
        17
    sobev  
       Aug 23, 2022
    我靠 拼接字符串还能用乘法 见识到了😂
    rxswift
        18
    rxswift  
       Aug 23, 2022
    @Leviathann 小刀剌屁股
    sadfQED2
        19
    sadfQED2  
       Aug 23, 2022 via Android
    @maxbon 浙江高考就考 Python ,上次给我亲戚孩子辅导作业,各种树,图,表算法,直接给我整自闭了。我一个正经科班毕业,工作写了好多年代码的人,高考 Python 题目没一个会
    whileFalse
        20
    whileFalse  
       Aug 23, 2022 via iPhone
    高中生为啥要学 python
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2424 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 60ms · UTC 04:40 · PVG 12:40 · LAX 21:40 · JFK 00:40
    ♥ Do have faith in what you're doing.