Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth
Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

42,690 questions

55,449 answers

573 users

How to use all tuple methods in Python

1 Answer

0 votes
tpl = ("python", "php", "java", "c++", "php")

print("1.", tpl[1], "\n")

for item in tpl:
    print(item)
print("\n")

if "python" in tpl:
    print("3.", "Yes")

print("4.", len(tpl))

print("5.", tpl.count("php"))

print("6.", tpl.index("c++"))

del tpl
# print("7.", tpl)  # Error: name 'tpl' is not defined


'''
run:
 
1. php

python
php
java
c++
php


3. Yes
4. 5
5. 2
6. 3

'''

 



answered Nov 22, 2018 by avibootz

Related questions

1 answer 136 views
1 answer 134 views
134 views asked Oct 17, 2023 by avibootz
1 answer 152 views
1 answer 161 views
161 views asked Nov 22, 2018 by avibootz
1 answer 183 views
183 views asked Nov 22, 2018 by avibootz
...