How to make for loop faster in python?

Python Validation Task?

  • Answer:

    Well, you could try casting the captured string to a float, to see whether you get a number or not. The other one could be compared something like: name1 != name2, or an if test where name1 == name2, and you'll likely want to do a while loop with a flag, similar like: name_notidentical = False While !name_notidentical: ....# input name 2 ....if name1 != name2: ........name_notidentical = True Or somesuch craft.

Matthew at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Well, you could try casting the captured string to a float, to see whether you get a number or not. The other one could be compared something like: name1 != name2, or an if test where name1 == name2, and you'll likely want to do a while loop with a flag, similar like: name_notidentical = False While !name_notidentical: ....# input name 2 ....if name1 != name2: ........name_notidentical = True Or somesuch craft.

Zarn

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.