Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Tuple_Exercise1_solution
#Q1. Create an empyty tuple T1=(); print(T1); #2. Create a Tuple having string ‘AI’, ‘Future’ T2=('AI', "Future"); print(T2); # 3. Create a Tuple with list [3,6,9,12] List =[3,6,9,12]; T3=tuple(List); print(T3); # 4. Create a Tuple with use of loop till 4 elements T4 = ('Pyth') n=5 for i in range(int(n)): T4 = tuple(T4, ); print(T4); #5. Create a Tuple with mixed datatype. T6= (2,"Naman",3,"Raman",4,"Shobit"); print(T6); #6. Create a Tuple with nested tuple T7 = (2,4,6,8) T8 = ('python', 'Langauage') T9 = (T7,T8) print("\nTuple with nested tuples: ") print(T9) #7. Create a Tuple with repetition of 3 times with element ‘Good’, “habits’ T10 = ('Good','habits') * 3; print("\nTuple with repetition: ") ; print(T10) ; # 8. Combine tuple t1=[2,4,6,8,10] to t2=[‘are’,‘ even’,’ no’] into tuple t3 and print t3. t1=(2,4,6,8,10) t2=('are','even','no') t3= t1+t2 print(t3) #9. Removing first three element from tuple n1=[‘scientist’] n1=('scientist') print("Removal of first three element : ") print(n1[3:]) #10. Reversing tuple n2=(‘scientist’) n2=('scientist') print("\nTuple after sequence of Element is reversed: ") print(n2[::-1]) #11. Display tuple t2=(‘2’ ‘neha’,3,’Jatin’,4,’Sneha’,5,’namit’) element from 2 to 5 n3=('2','neha',3,'Jatin',4,'Sneha',5,'namit') print("\nPrinting elements between Range 2-5: ") print(n3[2:5])
run
|
edit
|
history
|
help
0
PyClassLinSearch
"Hello,world!"
oppo mobile
5 ki table
NumPY01
PyDIP
https://rextester.com/REAL13110
Подарки
Q3
PYTHON 3