Guest User

Untitled

a guest
Jan 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. with open("user account .txt","w") as userFile:
  2. usernamePart1 = raw_input("Enter your name:")
  3. while not usernamePart1.isalpha():
  4. print("Invalid name, try again")
  5. usernamePart1 = raw_input("Enter your name:")
  6. usernamePart2 = raw_input("Enter your age:")
  7. while not usernamePart2.isdigit():
  8. print("try again")
  9. usernamePart2 = raw_input("Enter your age:")
  10. fullUsername = usernamePart1[:3] + usernamePart2
  11. userFile.write("Username:" + fullUsername)
  12. with open("reports.txt","a") as reports:
  13. reports.write("n" + "Username:" + fullUsername)
  14. print "Your username is" + " " + (fullUsername)
  15.  
  16.  
  17. UserYearGroup = int(raw_input("Enter your year group:"))
  18. while UserYearGroup < 7 or UserYearGroup > 15:
  19. print("Invalid year group, enter again")
  20. UserYearGroup = int(raw_input("Enter your year group:"))
  21. if UserYearGroup >= 7 and UserYearGroup <= 14:
  22. userFile.write("nYear Group:" + str(UserYearGroup))
  23. print(UserYearGroup)
  24.  
  25.  
  26. password = raw_input("Enter a password which you will remember:")
  27. userFile.write("nPassword:" + password)
Add Comment
Please, Sign In to add comment