0% found this document useful (0 votes)
10 views1 page

CSE 101: Intro to Python Basics

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)
10 views1 page

CSE 101: Intro to Python Basics

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

CSE 101 - Introduction to Programming

Tutorial 2

Topics to be covered:

● Types
● Operations and precedence
● Variables and assignments

1. When should we use “”” (triple quotes) to define strings?


2. Assuming (name = “John Smith”)
a. What does name[1] return?
b. What about name[-2]?
c. What about name[1:-1]?
d. How to get the length of name?
3. What is the result of this expression: “*” * 10
4. What is the difference between ​10 / 3​ and ​10 // 3​?
5. What is the result of 10 ** 3?
6. Given (​x = 1​), what will be the value of after we run (​x += 2​)?
7. What is the result of ​float(1)​?
8. What is the result of ​bool(“False”)​?
9. What are the falsy values in Python?
10. What is the result of ​10 == “10”​?
11. What is the result of ​“bag” > “apple”​?
12. What is the result of ​not(True or False)​?
13. Under what circumstances does the expression ​18 <= age < 65 ​evaluate to True​?
14. What is the difference between (3 * 7 + 2) * 0.1 and 3 * 7 + 2 * 0.1? Show how the
expression is evaluated by placing appropriate brackets.
15. What is the difference between “xyz” + “45” and “xyz” + 45? What is the output?
16. What does 3 ** 2 ** 3 evaluate to? Show the brackets used for precedence.

You might also like