0% found this document useful (0 votes)
4 views2 pages

Python Programming Concepts Explained

Python basic level questions
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Programming Concepts Explained

Python basic level questions
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PYTHON

1. Explain REPL in python


2. Lists and tuples, lists vs tuples
3. How do you declare a variable or object as global
4. Program for prime number
5. Output below – tuple doesn’t support item deletion

Nums = (1,2,3,4)

Del Nums[1:3]

6. Output below

','.join('TCS Services')

7. Program for Armstrong number – 1634 is Armstrong number

Ex: 123 = 1**3+2**3+3**3 19 = 1**2+9**2 1634=1**4+2**4+3**4+4**4

8. Output below – integer data type has no length

Number = 1234

Length = len(Number) + Number

Print(Length, ‘and’, Number)

9. Output the below code – 200 200

x=200
def myfunc():
x = 300

print(x)
myfunc()

print(x)
10. Output the below code – x is not defined

def myfunc():
global x
x = 300
print(x)
myfunc()

print(x)
11. Set vs frozenset & with an example
12. What is pass in python & its use
13. What is modules and packages in python
14. What is global, protected & private attributes in python
15. What is self in python
16. What is __init__ in python
17. Break vs continue vs pass
18. What is docstring in python
19. Indexing vs slicing . what data types supports what?
20. How to make python script executable on unix?

Script file must begin with #!/usr/bin/env python

21. What is enum in python


22. What is eval in python
23. Output the code below

Fruit = ‘Kiwi’

Fruit[-3]

Fruit[10]

Fruit[-3:10]

24. Write Fibonacci series & factorial coding in python


25. Palindrome – s==s[::-1]
26. Code for below – [Link]('_',' ').title().replace(' ','')

Input: brains_love_challenges

Output: BrainsLoveChallenges

27.

You might also like