I'm trying to make my Python read only the first 3 digits of a string and print an answer based on the first three digits of the string.
I tried:
if str[1,2,3] = 080:
print(...)
elif str[123] =090:
print(,,,)
I'm trying to make my Python read only the first 3 digits of a string and print an answer based on the first three digits of the string.
I tried:
if str[1,2,3] = 080:
print(...)
elif str[123] =090:
print(,,,)
use the index between the subscript like:
str[0:3] or str [:3]
this will take the cursor from 0th index to 2nd index