什么开始! ='':如果开始呢? [英] What do start ! = '': and if start do?
问题描述
word ='披萨'
打印('输入披萨的开头和结尾索引')
start =无
while start!='':
start =(输入('\\\
Start:'))
如果开始:
start = int(start)
finish = int(输入('完成:'))
print('word [',start,':',finish,')是',end ='')
print(word [start:finish])
我的尝试:
我不尝试任何东西。我只是从书中复制这段代码,我想知道他们做了什么。
这不是做什么开始!='':如果开始做的话?,它们只与上下文相关。
第一个是更大声明的一部分:
while start!= ' ':
start =(输入(' \ nStart:'))整个说:
继续读取输入,直到那里有实际数据,即变量start不是空字符串。
如果开始是相似的 - 查看你的课程笔记,这应该很简单。
参见 Python教程& mdash; Python 3.3.6文档 [ ^ ]
word = 'pizza'
print ('Enter the beginning and the ending index of your pizza')
start = None
while start != '':
start = (input ('\nStart:'))
if start:
start = int (start)
finish = int (input ('Finish:'))
print ('word [', start, ':', finish, ') is ' , end = ' ')
print (word [start:finish])
What I have tried:
I don't try anything. I just copy this code from a book and I am wondering what they do.
It isn't "What do start ! = '': and if start do?", they are only relevant in context.
The first is part of a larger statement:
while start != '': start = (input ('\nStart:'))And the whole this says:
Keep reading the input until there is actual data there, i.e. the variable "start" is not an empty string.
if start is similar - look through your course notes and it should be pretty simple to work out.
See The Python Tutorial — Python 3.3.6 documentation[^].
这篇关于什么开始! ='':如果开始呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!