[Tutor] Input handling?
Scott Yamamoto
scott.yamamoto at yahoo.com
Tue Sep 18 19:23:39 CEST 2012
0) using mobile yahoo mail
1) expect: raw_input to assign the variable to ""
2)No output to stderr; has a loading symbol after hitting enter without input (tried both input and raw_input)
Doesn't affect active interpreter. Only affects the screen with the run option.
3)
def simulation():
import random
from random import randrange
from time import sleep
print "Welcome to The World."
sleep(1)
print "Now Loading..."
sleep(1.5)
#Intro page
print
gender = raw_input("Gender: male/female \n")
if gender != "male" or "female":
gender = "male"
Mlist = ["Jacob", "Mason", "William", "Jayden", "Noah", "Michael", "Ethan", "Alexander", "Aiden", "Daniel", "Anthony", "Matthew", "Elijah", "Joshua", "Liam", "Andrew", "James", "David", "Benjamin", "Logan"]
Flist = ["Sophia", "Isabella", "Emma", "Olivia", "Ava", "Emily", "Abigail", "Madison", "Mia", "Chloe", "Elizabeth", "Ella", "Addison", "Natalie", "Lily", "Grace", "Samantha", "Avery", "Sofia", "Aubrey"]
Llist = ["Smith", "Johnson", "Williams", "Jones", "Brown", "Pavis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson"]
username = raw_input("Input your full name: \n")
if username == "":
if gender == "male":
username = random.choice(Mlist) + " " + random.choice(Llist)
else:
username = random.choice(Flist) + " " + random.choice(Llist)
print
print "Username: %s. Gender: %s." % (username,gender)
simulation()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120918/8b056169/attachment-0001.html>
More information about the Tutor
mailing list