Nowcoder | 牛课网练习,主要包括leetcode , 剑指offer,Cracking the Coding | Learning library
kandi X-RAY | Nowcoder Summary
kandi X-RAY | Nowcoder Summary
牛课网练习,主要包括leetcode,剑指offer,Cracking the Coding Interview,PAT,华为上机测试,算法课程学习,一些公司笔试题目等。
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Nowcoder
Nowcoder Key Features
Nowcoder Examples and Code Snippets
Community Discussions
Trending Discussions on Nowcoder
QUESTION
I'm working on a website called NOWCODER, similar to the Leetcode but a Chinese version.
One of the question is asking for user to input some text(multiple lines) and determine whether the texts that enter are qualified as an appropriate password.
What bothers me is the input()
so I write my code on Jupyter notebook (python 3) as:
...ANSWER
Answered 2020-Jan-12 at 20:02The second code is fine, you just need to send an end-of-file signal (EOF), which you can do on Unix/Linux with Ctrl+D and on Windows with Ctrl+Z. Python receives this as an EOFError
, which your except
clause will catch and break the loop. However, a bare except
is bad practice. You should at least change it to except Exception
.
That said, you could simplify massively by using fileinput.input
to take input.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Nowcoder
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page