mardi 26 octobre 2021

How could I use the if function to verify if index count is true or false?

I have literally just begun self teaching some programming and decided to start with Python. As I've been going through the very first few exercises, I thought to myself how can I write something that tells me whether the index count of the string is what I think it is? Something along the lines of

astring = "Hello world!"
if (astring.index ("H") = 0) = True
print true

I know it's mega noob stuff but I was curious cos I couldn't do it myself and couldn't find similar questions or probably really understand those that were. Cheers all

Aucun commentaire:

Enregistrer un commentaire