Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
24 views
Lab Manual
Uploaded by
Hemraj Patel Bhuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Lab Manual For Later
Download
Save
Save Lab Manual For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
24 views
Lab Manual
Uploaded by
Hemraj Patel Bhuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Lab Manual For Later
Carousel Previous
Carousel Next
Save
Save Lab Manual For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 54
Search
Fullscreen
WPF LEVEL ALE EADZLDOOCA*APAGAGAADAASAEUV PRACTICAL-L Description: ‘Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals or characters in these variables. Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically values to variables. The operand to the when you assign a value to a variable. The equal sign (=) is used to assi ight of the = operator is the value stored left of the = operator is the name of the variable and the operand to the in the variable Create a program that asks the user to enter their name and their age. Print out a message addresses to them that tells them the year that they will turn 100 years old Code: Name = put Cente your merme = age > intCinput C’ Hew old you anec- “) CYeas = 2022 ageloo = Ciee— ege) + C_ Yeah agetoo 2 CC year - age) t (oe Priv CHorne ,” Will Tusm [co at year cyeloo) 12ourPuT: Cte, your mame : Boss How old you ane - 52 Bess Wil) dum leo at year Zeto Post Pra Questions: 1, Which one of the following is correet way of declaring and initializing a variable, x with value S? (a) ims (opin x=5 (dpdectare x°5 2. All keyword in python aren (a) Lowercase (1) Uppercase ne of the tk 3. Which of the following cannot be a variable? | (a) _ init «yin 4. Which of the following characteris used to give single-line comments in Python? | @ (by! oa © the following code snippet? ‘5, What will be the o print(eype(S /2)) | 51/2) cavrieaeanirian () int and float (©) Mloat and float (4) int and int | Conclusion: Pit np sk oakhdatt bae bs Ob OO ae & ac!{Fo he statements ed ih wie pe che tent enc wh he ‘den cans omeea es "he emmys ary dedi the gc in +a Art i. ‘ss sett feo ch mae a porrlbinytn.Asinge it my ‘com Daye epen Sig tw Osis ar ile hy en be ere ‘stayin ween anne inc The leita nel cing eine ‘ee the ning shih eg hefner ne at ete sn iat apg clones hela wh nce ning iso din place ‘Nt tin apne leh tin pt cosas eee ‘Ne Lots to peeing en i utr ein ne ment ‘chon List pend td ping ingen heel of he La Sine pi) + tem ot mo eae fhe atABE7Z7TGOIIZBAAIBCHE AZZ AW FE PRACTICAL Deseription: List Comprehension List comprehension offers a shorter syntax when you want to create a new list based on the values of an existing list. Example: Based on a list of fruits, you want a new list, containing only the fruits with the letter "a" in the name. Without list comprehension you will have to write a for statement with « conditional test inside: ple: fruits = [*apple”, "banana’ ‘cherry, "kiwi, "man newlist = [] for x in fiuits: iP"a" in newlistappend(x) print(newlist) Output: ['apple’, banana’, ‘mango'] 11, 1,2, 3, 5,8, 13, 21, 34, Hb=[1 ins only the ele m:T 3,4, 5,6, 7, 8,9, 10, 11, 12, 13] and A vo list 1s that are common between the lists write a program that ret ts of different si Write this using (Without duplicates), Make sure your program works on two at least 4 comprehension, Self: Randomly generate (wo lists t0 tes Code: ‘a EU 4,27 3,5. ¢,13, 2134/55/11 se a eee ele @-CA Ooms inn cle Roienton| b 7 28fos, Sin b: — | Wo fess: Pi mot im c: Gappend Cid w - o * ‘Pe ® Print CoD Output: o>, ste | Post Practical Questions: (1) What will be the output of the following Python code snippet? k= [print(i) for iin my_string if not in "aciou") (a) prints all the vowels in my_ string | (b) prints all the consonants in my_string | Corpses FFT as aps | (0) pri only on exceuting print(k) 29 iii nicc ace edbedeeneenePee see esa TEE EL TITL Definition and Usage ‘The pow() finetion returns the value of x to the power of y (xy). Ifa third parameter is present, it returns x to the power of y, modulus z Syntax: pow(s, y, z) Aim: Let’s say I give you a list saved in a variable: ‘one line of Python that takes this list and makes H odd numbers from 110 power of 2 from 1 to 8 ns prime and n ange 1 to 50 on TH) 4,8, 16, 25, 36, 44 64,01 lool cote (ed EES CL ee ees Oo st.append Ct) Print (o>Output: [4 16, 36,64, lee] 35pectoermamin fr n-ne tome ‘een of mer in he sme ent Te Fac sence spre a | Teseqemeeete the ict NARI SNaet Cleon * , tee eo Cibo n=) + fibacn-a9) 02 ick Cipuk Erhx Be rumba: ")) | Netacsal 2 | pk iat)Eee EEE ELE EERE RL DIOLLIPTd PD J { |route Questions 1 Miho lowing bo decreas? \ ara oa dae eve meh ater cars a fio efition *) Meningie able ant cero ert aces eta clas meses Faces vrs pag of rae os Aton imposes of pet sae esp nt sly oie | afbubiseet ato OSegetent tise | xa law ec ei i fa cl? | atid ae ect ‘esa ype nin les? 2) Demis te bj ne aye ete a nna ee —
You might also like
Python Fundamentals For Machine Learning Version1
PDF
No ratings yet
Python Fundamentals For Machine Learning Version1
58 pages
keypycie1
PDF
No ratings yet
keypycie1
10 pages
Introduction To Python
PDF
No ratings yet
Introduction To Python
16 pages
Python Learinng Material
PDF
No ratings yet
Python Learinng Material
94 pages
WEEK 02 - Variables and Types Control Statements
PDF
No ratings yet
WEEK 02 - Variables and Types Control Statements
16 pages
Python Question Paper 1
PDF
No ratings yet
Python Question Paper 1
9 pages
Python Cheat Sheet - Lecture Notes 1-19 Python Cheat Sheet - Lecture Notes 1-19
PDF
No ratings yet
Python Cheat Sheet - Lecture Notes 1-19 Python Cheat Sheet - Lecture Notes 1-19
4 pages
Revision Tour
PDF
No ratings yet
Revision Tour
7 pages
An Introduction To Python Programming Language
PDF
No ratings yet
An Introduction To Python Programming Language
63 pages
28 Saturday: Py-Hon in Slallalion Ooxkfng Progam Py-Then Koswords Jdentievs
PDF
No ratings yet
28 Saturday: Py-Hon in Slallalion Ooxkfng Progam Py-Then Koswords Jdentievs
25 pages
01_Python_I_All_Master_13_02_2025
PDF
No ratings yet
01_Python_I_All_Master_13_02_2025
258 pages
Python Bca Qustion Banks Sem-5
PDF
No ratings yet
Python Bca Qustion Banks Sem-5
7 pages
CS Practical
PDF
No ratings yet
CS Practical
74 pages
Python Notes
PDF
No ratings yet
Python Notes
141 pages
DS Lab Manual
PDF
No ratings yet
DS Lab Manual
110 pages
SCH_BPLCK205B june.july24
PDF
No ratings yet
SCH_BPLCK205B june.july24
17 pages
Python Data Types
PDF
No ratings yet
Python Data Types
20 pages
Python
PDF
No ratings yet
Python
23 pages
1 Python
PDF
No ratings yet
1 Python
38 pages
Python Jan 2025
PDF
No ratings yet
Python Jan 2025
23 pages
2020 ITT205
PDF
No ratings yet
2020 ITT205
9 pages
2022-23
PDF
No ratings yet
2022-23
9 pages
Chapter-3 Data Handling
PDF
No ratings yet
Chapter-3 Data Handling
33 pages
2 Python
PDF
No ratings yet
2 Python
131 pages
AI Lab2
PDF
No ratings yet
AI Lab2
28 pages
Codeacademy Python
PDF
No ratings yet
Codeacademy Python
37 pages
interview python
PDF
No ratings yet
interview python
15 pages
EX-406 Python Lab Manual
PDF
No ratings yet
EX-406 Python Lab Manual
15 pages
Python
PDF
No ratings yet
Python
46 pages
My Python Notes
PDF
100% (1)
My Python Notes
17 pages
PythonTraining MD Saiful Azad UMP
PDF
No ratings yet
PythonTraining MD Saiful Azad UMP
54 pages
Week 6 First Year
PDF
No ratings yet
Week 6 First Year
11 pages
CP_Unit_1
PDF
No ratings yet
CP_Unit_1
6 pages
Python - Revision Tour
PDF
No ratings yet
Python - Revision Tour
79 pages
Informatics Practices (Part-2)
PDF
No ratings yet
Informatics Practices (Part-2)
28 pages
002 Python Variables and Python Data Types Updated
PDF
No ratings yet
002 Python Variables and Python Data Types Updated
16 pages
Python Crash Course
PDF
No ratings yet
Python Crash Course
12 pages
Python Reserved Words
PDF
No ratings yet
Python Reserved Words
2 pages
Python: BY Kannan Moudgalya
PDF
No ratings yet
Python: BY Kannan Moudgalya
21 pages
Pychapt2 New
PDF
No ratings yet
Pychapt2 New
44 pages
Python Notes 1
PDF
No ratings yet
Python Notes 1
47 pages
Tokens in PYTHON
PDF
No ratings yet
Tokens in PYTHON
49 pages
Model Answer Paper
PDF
No ratings yet
Model Answer Paper
27 pages
Introduction To Python (Part II)
PDF
No ratings yet
Introduction To Python (Part II)
29 pages
Python Introduction
PDF
No ratings yet
Python Introduction
53 pages
Module 2 Data Types, Operators, Variables Assignment
PDF
No ratings yet
Module 2 Data Types, Operators, Variables Assignment
8 pages
Python For Data Science (Slideshare)
PDF
No ratings yet
Python For Data Science (Slideshare)
54 pages
Python Notes
PDF
No ratings yet
Python Notes
18 pages
Interview Questions1
PDF
No ratings yet
Interview Questions1
16 pages
Computer Science Xi Paper PT-1 Hy PT-2 See
PDF
No ratings yet
Computer Science Xi Paper PT-1 Hy PT-2 See
14 pages
L2 - Introduction to Python
PDF
No ratings yet
L2 - Introduction to Python
97 pages
Module 5 Programming Foundation and Exploratory Data Analysis
PDF
No ratings yet
Module 5 Programming Foundation and Exploratory Data Analysis
152 pages
Python Cheat Sheet: Conditional Tests (Comparisons)
PDF
No ratings yet
Python Cheat Sheet: Conditional Tests (Comparisons)
2 pages
Introduction To Python
PDF
No ratings yet
Introduction To Python
56 pages
Python Numpy Tutorial
PDF
No ratings yet
Python Numpy Tutorial
22 pages
DWM Experiment 1
PDF
No ratings yet
DWM Experiment 1
9 pages
Lab 2-Part 2: Lists
PDF
No ratings yet
Lab 2-Part 2: Lists
5 pages
Python Cheat Sheet: by Via
PDF
No ratings yet
Python Cheat Sheet: by Via
4 pages
Machine Learning Libraries
PDF
No ratings yet
Machine Learning Libraries
38 pages
Quetion Bank NSML
PDF
No ratings yet
Quetion Bank NSML
6 pages
Unit 1: Advanced Computer Networks & Security
PDF
No ratings yet
Unit 1: Advanced Computer Networks & Security
64 pages
Project Report
PDF
No ratings yet
Project Report
41 pages
2023-01-10 Hostedscan Report
PDF
No ratings yet
2023-01-10 Hostedscan Report
30 pages
2023-01-26 Hostedscan Report
PDF
No ratings yet
2023-01-26 Hostedscan Report
30 pages