Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Overig

Sale notes online your Nr 1 Resource,for passing Exam at VCUj

Beoordeling
-
Verkocht
-
Pagina's
17
Geüpload op
03-08-2023
Geschreven in
2023/2024

I've written dozens of study guides for all my this material you'll be sure to pass your exams,Questions? Don't hesitate to send me messages

Instelling
Vak

Voorbeeld van de inhoud

20CS201 PROBLEM SOLVING USING PYTHON
Answer Key
UNIT – 2 (Introduction to Python Programming)
2 Marks
1.Define python

 Python is an object-oriented, high level language, interpreted
 Dynamic and multipurpose programming language.

2. Give the features of python.

 Easy to Use
 Expressive Language
 Interpreted Language
 Free and Open Source
 Object-Oriented language


3. State about python interpreter.
 The machine that translates and runs Python code is called the Python Interpreter:
 There are two ways namely interactive mode and script mode. The >>> is called the
Python prompt.


4. Compare interactive mode and script mode.

 In interactive mode, type python expressions in the Python Interpreter window and the
results are shown immediately.

 In script mode, type program in a file and use the interpreter to execute the contents of
the file. Such a file is called a script.


5. Define value and variable in python.
value
 A value is one of the fundamental things—like a letter or a number—that a program
manipulates.
variable
 A variable is a name that refers to a value. The assignment statement gives a value to a
variable. Eg: >>> n = 17

6. List the standard data types in python.
Python has five standard data types:
 Integer

,  Float
 Strings
 List
 Tuples
 Boolean


7. Quote about python strings.
 Strings in Python are identified as a contiguous set of characters represented in the
quotation marks.
 Python allows for either pairs of single or double quotes. Subsets of strings can be taken
using the slice operator ([ ] and [:] ) The plus (+) sign is the string concatenation operator
and the asterisk (*) is the repetition operator. Eg:str = 'Hello World!'

8. List the features of ‘ lists’ in python
 A list contains items separated by commas and enclosed within square brackets ([]).
 The values stored in a list can be accessed using the slice operator ([ ] and [:]) with
indexes starting at 0 in the beginning of the list and working their way to end -1. The plus
(+) sign is the list concatenation operator, and the asterisk (*) is the repetition operator.
For example :

list = [ 'abcd', 786 , 2.23,'john', 70.2 ] print list[0]
o/p
a
b
c
d

9. Differentiate between list and tuple.

 The main differences between lists and tuples are: Lists are enclosed in brackets ( [ ] )
and their elements and size can be changed,
 while tuples are enclosed in parentheses ( ( ) ) and cannot be updated. Tuples can be
thought of as read-only lists.

10. What are keywords?
 Keywords are the reserved words in Python. We cannot use a keyword as variable name,
function name or any other identifier.
 In Python, keywords are case sensitive. There are 33 keywords in Python.
Eg: False, class, finally, return

11.Define expressions.
 An expression is a combination of values, variables, operators, and calls to functions.
 If you type an expression at the Python prompt, the interpreter evaluates it and displays
the result:
>>> 1 + 1=2

, 12. Quote about statement.
 A statement is an instruction that the Python interpreter can execute.
 When you type a statement on the command line, Python executes it. Statements don‘t
produce any result. For example, a = 1 is an assignment statement. if statement, for
statement, while statement etc. are other kinds of statements.

13. Label operators which python support?

 Arithmetic Operators
 Comparison (Relational) Operators
 Assignment Operator
 Logical Operators
 Bitwise Operators
 Membership Operators
 Identity Operator

14. What is an Arithmetic operator?
 Arithmetic operators are used to perform mathematical operations like addition,
subtraction, multiplication etc.
 The operators are: +,-,/,%,*,**

15. Summarize is the use of comparison operator.
 Comparison operators are used to compare values.
 It either returns True or False according to the condition.
>,<,>=,<=,==,!=

16. Infer about logical operators and Bitwise operators.
 Logical operators are the and, or, not operators. Bitwise operators act on operands as if
they were string of binary digits.
 It operates bit by bit, hence the name. The operators are:&,|,`^,>>,<<

17. State about assignment statements.
 Assignment operators are used in Python to assign values to variables.a = 5 is a simple
assignment operator that assigns the value 5 on the right to the variable a on the left.
 Eg:x=44
18. Mention the features of identity operators?
 The is and is not are the identity operators in Python. They are used to check if two
values (or variables) are located on the same part of the memory.
 Two variables that are equal does not imply that they are identical.

19. Give the characteristics of membership operator?
 The membership operators are in and not in. They are used to test whether a value or
variable is found in a sequence (string, list, tuple, set and dictionary).
 In a dictionary we can only test for presence of key, not the value.

Geschreven voor

Vak

Documentinformatie

Geüpload op
3 augustus 2023
Aantal pagina's
17
Geschreven in
2023/2024
Type
OVERIG
Persoon
Onbekend

Onderwerpen

$8.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
vengatedits

Maak kennis met de verkoper

Seller avatar
vengatedits Excel Engineering College
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
2 jaar
Aantal volgers
0
Documenten
19
Laatst verkocht
-
Sale notes online your Nr 1 Resource,for passing Exam at VCU

I've written dozens of study guides for all my this material you'll be sure to pass your exams,Questions? Don't hesitate to send me messages

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen