0
If I add +1 after : (semicolon) it prints nothing in domain name in line 3. Why?
2 Respuestas
+ 6
The number after the colon ends the string slice at one character before that index position, so 1 after the colon (:) means the last character in the slice is at index 0, i.e. the first character. If there is no number after the colon, the slice goes to the end of the string. See
https://code.sololearn.com/cXNzv56rgiyL
Btw you can also do it this way:
email = input("Enter your email address: ").strip().split("@")
email_username = email[0]
email_domain = email[1]
0
Thanks a lot ☺️☺️