while 循环创建 [英] While loop creating

查看:37
本文介绍了while 循环创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 Python 编写一个程序,该程序定义了一个接受单个参数的函数.该函数必须是一个 while 循环,返回它等于的 16 的最大幂.但是,我不确定如何编写 while 循环.

I am writing a program in Python that defines a function that takes a single argument. The function has to be a while loop the returns the largest power of 16 that it is equal to. However, I am not sure how to write the while loop.

推荐答案

Python 文档

while True:
    n = input("Please enter 'hello':")
    if n.strip() == 'hello':
        break

所以,通俗地说

while <condition>:
    ...

这篇关于while 循环创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆