0% found this document useful (0 votes)
24 views3 pages

Assignment No 1 XI

This document contains a series of assignments focused on Python fundamentals, covering topics such as keywords, identifiers, literals, strings, expressions, statements, and various programming concepts. It includes questions about the types of literals, string representation, error identification in code, and the importance of variables and comments in programming. Additionally, it poses practical coding tasks and theoretical questions to assess understanding of Python programming principles.

Uploaded by

05-Bibek Khadka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Assignment No 1 XI

This document contains a series of assignments focused on Python fundamentals, covering topics such as keywords, identifiers, literals, strings, expressions, statements, and various programming concepts. It includes questions about the types of literals, string representation, error identification in code, and the importance of variables and comments in programming. Additionally, it poses practical coding tasks and theoretical questions to assess understanding of Python programming principles.

Uploaded by

05-Bibek Khadka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Fundamentals – Assignments No- 1

1. What is the difference between a keyword and an identifier?


2. What are literals in Python? How many types of literals are allowed in Python?
3. How many ways are there in Python to represent an integer literal?
4. How many types of strings are supported in Python?
5. What factors guide the choice of identifiers in programs?
6. How can you create multi-line strings in Python?
7. (Question number 8 seems to be missing in the original list.)

8. What is None literal in Python?


9. Identify the types of the following literals:

 23.789
 23789
 True
 „True‟
 “False”
 0xFACE
 00213
 00789
11. What is the difference between an expression and a statement in Python?
12. Which of the following are syntactically correct strings?

 “This course is great!”


 „She shouted “Hello!” very loudly‟
 “Goodbye‟
 „This course is great!‟
 “Hello
 „I liked the movie “Bruce Almighty” very much.‟

13. What is the error in the following Python program with one statement?
print(“My name is”, name)
14. This code is not giving the desired output. Why?
Number = input("Enter Number")
DoubleTheNumber = Number * 2
print(DoubleTheNumber)

15. Why is the following code giving errors?


name = "Rehman"
print("Greetings !!!")
print("Hello", name)
print("How do you do ?")

16. Write a program to obtain temperature in Celsius and convert it into Fahrenheit.

17. What will be the output of the following code?


name = 'Simar'
age = 17
print(name, ", you are", 17, "now but", end=" ")
print("you will be", age + 1, "next year")

18. What will be the output of the following code?


x, y = 2, 6
x, y = y, x + 2
print(x, y)

19. How are keywords different from identifiers?


20. What are literals in Python? How many types of literals are allowed in Python?
21. Can nongraphic characters be used in Python? How? Give examples.
22. How are floating constants represented in Python? Give examples.
23. How are string literals represented and implemented in Python?
24. Which of these is not a legal numeric type in Python?


(a) int

(b) float

(c) Decimal

25. Which argument of print() would you set for:



(i) Changing the default separator (space)?

(ii) Printing the next output in the same line?

26. What is an expression and a statement?


27. What are operators? What is their function? Give examples of unary and binary
operators.
28. What all components can a Python program contain?
29. What do you understand by block/code block/suite in Python?
30. What is the role of indentation in Python?
31. What are variables? How are they important for a program?
32. What do you understand by undefined variable in Python?
33. What is Dynamic Typing feature of Python?
34. What would the following code do:
X = Y = 7

35. What is the error in the following code:


X, Y = 7

36. Following variable definition is creating a problem: X = 0o281. Find reasons.


37. “Comments are useful and easy way to enhance readability and
understandability of a program.” Elaborate with examples.

You might also like