Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 User Name Remember Me? Password

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 12-30-2011, 01:10 AM PM User | #1 pwolf New to the CF scene   Join Date: Dec 2011 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts stuck with python, please advise so im trying to make it so that pressing enter without inputting any value, will break the loop, however, an empty string can be used because of ```for i in range(len(x_str_array)): x[i] = int(x_str_array[i])``` bit. Code: ```'Exercise 7.3' # modified program from exercise 7.2 a=1 z="" while x !=z: x_str = raw_input('Enter Start,Stop,Increment: ') if x==z: break else: x_str_array = x_str.split(',') # splits the string where a comma pops up x = range(len(x_str_array)) # Preallocation step- makes x= the same length as x_str_array for i in range(len(x_str_array)): x[i] = int(x_str_array[i]) a=x[0] b=x[1] c=x[2] for number in range(a,b,c): print "number:", number, " square:", number**2, " cube:", number**3``` please advise me on this. p.s yes i am a complete novie, haha i thought maybe using an empty tuple or list or something, but that wouldn't work either.
01-01-2012, 01:19 PM   PM User | #2
Samhain13
Regular Coder

Join Date: Aug 2008
Location: Pilipinas
Posts: 165
Thanks: 4
Thanked 18 Times in 18 Posts
Quote:
 so that pressing enter without inputting any value, will break the loop
Code:
```while True:
# Get some user input.
x_str = raw_input("Someting: ")
# If the user simply hits enter or supplies a string full of spaces, break.
if not x_str or x_string.isspace():
break
# More stuff here.```
Happy new year!
__________________
I am a Man of Truth. I am a Free Human Person. I am a Peacemaker.
** Independent Multimedia Artist in Pasig **

 Bookmarks

 Tags input, novice, python, string

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 07:20 PM.