English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

What is the use of the type() function in python?

Advertisements
Advertisements

Question

What is the use of the type() function in python?

Options

  • To create a Tuple.

  • To know the type of an element in the tuple.

  • To know the data type of python object.

  • To create a list.

MCQ
Advertisements

Solution

To know the data type of python object.

shaalaa.com
Concepts of Tuples in Python
  Is there an error in this question or solution?
Chapter 9: Lists, Tuples, Sets and Dictionary - Evaluation [Page 168]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 9 Lists, Tuples, Sets and Dictionary
Evaluation | Q 8. | Page 168

RELATED QUESTIONS

What are the advantages of Tuples over a list?


What is a nested tuple? Explain with an example.


“Lists and Tuples are ordered”. Explain.


What advantages do tuples have over lists?


When to use a tuple or dictionary in Python. Give some examples of programming situations mentioning their usefulness.


Prove with the help of an example that the variable is rebuilt in case of immutable data types.


TypeError occurs while statement 2 is running. Give reason. How can it be corrected?

>>> tuple1 = (5)         #statement 1
 >>> len(tuple1)         #statement 2

Write a program to read the email IDs of n number of students and store them in a tuple. Create two new tuples, one to store only the usernames from the email IDs and the second to store domain names from the email IDs. Print all three tuples at the end of the program. [Hint: You may use the function split()]


Write a program to input the names of n students and store them in a tuple. Also, input a name from the user and find if this student is present in the tuple or not. We can accomplish these by:

writing a user-defined function


A bank is a financial institution that is involved in borrowing and lending money. With advancements in technology, online banking, also known as internet banking allows customers of a bank to conduct a range of financial transactions through the bank’s website anytime, anywhere. As part of the initial investigation, you are suggested to

  • collect a bank application form. After careful analysis of the form, identify the information required for opening a savings account. Also, enquire about the rate of interest offered for a saving account.
  • The basic two operations performed on an account are Deposit and Withdrawal. Write a menu-driven program that accepts either of the two choices of Deposit and Withdrawal, then accepts an amount, performs the transaction, and accordingly displays the balance. Remember, every bank has a requirement for a minimum balance which needs to be taken care of during withdrawal operations. Enquire about the minimum balance required in your bank.
  • Collect the interest rates for opening a fixed deposit in various slabs in a savings bank account. Remember, rates may be different for senior citizens.

Finally, write a menu-driven program having the following options (use functions and appropriate data types):

  • Open a savings bank account
  • Deposit money
  • Withdraw money
  • Take details, such as the amount and period for a Fixed Deposit, and display its maturity amount for a particular customer.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×