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

Ws-1 Python Introduction Worksheet 1

The document is a worksheet focused on Python programming, specifically on tokens, variable names, and expressions. It includes questions about identifying valid and invalid variable names, keywords, operators, data types, and evaluating expressions. Additionally, it contains exercises on output formatting and arithmetic operations in Python.

Uploaded by

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

Ws-1 Python Introduction Worksheet 1

The document is a worksheet focused on Python programming, specifically on tokens, variable names, and expressions. It includes questions about identifying valid and invalid variable names, keywords, operators, data types, and evaluating expressions. Additionally, it contains exercises on output formatting and arithmetic operations in Python.

Uploaded by

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

Worksheet 1: Python introduction - Tokens and expression

1. Out of the following, find those identifiers, which cannot


be used for naming Variable or Functions in a Python program:
Total*Tax
While
class
switch
3rdRow
finally
Column31
_Total

2. Identify invalid variable names out of the following.


State reason if invalid.
(i) for (ii) –salary (iii) salary12 (iv) product

3. Identify invalid variable name(s) out of the following. State reason if invalid

(i) While (ii) 123salary (iii) Big (iv) Product

4. Help Manish in identifying the incorrect variable name with justification


from the following:
(i) unit@price (ii) fee (iii) userid (iv) avg marks [SP 18]

5)Identify the invalid variable names. State the reason if invalid. 1 [2018]
(i) Marks Unit (ii) Product_1 (iii) Sales123 (iv) 2Marks

6. Which of the following can be used as valid variable identifier(s) in Python?


2[d 17]
(i) total (ii) 7Salute (iii) Que$tion (iv) global

7) Which of the following can be used as valid variable identifier(s) in Python? 2


[compt 17]
(i) elif (ii) BREAK (iii) in (iv) _Total

8. Write the type of python keywords and user defined identifiers from the
following:
(i) For (ii) Delete (iii) else (iv) Value

9. Write the type of python keywords and user defined identifiers from the
following :
(i) case (ii) _delete (iii) while (iv) 21stName

10. Write the type of python keywords and user defined identifiers from the
following:
(i) in (ii) While (iii) and (iv) Num_2

11) Write the type of tokens from the following: 1[SP 20]
(i) if (ii) roll_no

12. Which of the following are valid operators in Python? [comptt 19]
(i) += (ii) ^ (iii) in (iv) && (v) between
(vi) */ (vii) is (viii) like

13. Which of the following are valid operators in Python: [2019]


(i) ** (ii) */ (iii) like (iv) ||
(v) is (vi) ^ (vii) between (viii) in

14. Which of the following is valid arithmetic operator in Python: [SP 20]
(i) // (ii) ? (iii) < (iv) and

15. Identify the valid arithmetic operator in Python from the following.
(i) ? (ii) < (iii) ** (iv) and [SP 21]

16) Write the names of any four data types available in Python. 2[2019]

17) Consider the statement:


first_name = “Ayana”;
(i) What is the datatype of first_name ?
(ii) Is 325 the same as “325” ?
Give reason.

18)write the mutable and immutable datatypes

19)Write the value that will be assigned to variable x after executing the
following statement:
x = 3 + 36/12 + 2*5

20. Write the value that will be assigned to variable c after executing the
following statement:
C = 25-5*4/2-10+4

21. Write the value that will be assigned to variable x after executing the
following statement:
x = 20 -5 + 3 * 20/5

22. Evaluate the following expressions: [SP 21]


(a) 6 * 3 + 4**2 // 5 – 8
(b) 10 > 5 and 7 > 12 or not 18 > 3

23)
Give the output
(i) print(20,sep="-",end="$")
(ii) print(40,50,60,sep="*",end="!")
(iii) print("hello,hi,bye",sep="*",end="!")
(iv) print("hello","hi","bye",sep="*",end="!")
(v) print(2>5,7<10,end="@")
(vi) print(“2*3,6*5”,sep="%")
(vii) print(2*3,6+5,sep="+")

You might also like