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

Python Basics: Loops, Functions, and Algorithms

The document explains various programming concepts in Python, including loops, functions, and algorithms. It covers the differences between compiled and interpreted languages, the role of the Python interpreter, and the characteristics of pseudocode. Additionally, it discusses the applications of Python and provides examples for better understanding.

Uploaded by

nehaprjpt00
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)
13 views1 page

Python Basics: Loops, Functions, and Algorithms

The document explains various programming concepts in Python, including loops, functions, and algorithms. It covers the differences between compiled and interpreted languages, the role of the Python interpreter, and the characteristics of pseudocode. Additionally, it discusses the applications of Python and provides examples for better understanding.

Uploaded by

nehaprjpt00
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

Q1.

Explain for and while loops with example


For loop repeats over a sequence. While loop repeats until condition is true. Example: for i in
range(5): print(i) while x<5: print(x); x+=1

Q2. Print character of given ASCII value


Use chr() and ord(). Example: chr(65)->'A', ord('A')->65

Q3. Key features and advantages of Python


Easy, interpreted, object-oriented, open source, large libraries. Adv: Fast development,
cross-platform, readable syntax.

Q4. Role of Python interpreter (interactive vs script)


Interactive: run line by line in terminal. Script: code saved in .py file and executed at once.

Q5. Compiled vs Interpreted languages


Compiled: translate full code before run (C, C++). Interpreted: line by line (Python, JS). Python is
interpreted.

Q6. Application of Python


Used in web dev, data science, ML, AI, automation, games, IoT, hacking.

Q7. Declare and call functions


def greet(name): print('Hello',name) greet('Mahendra')

Q8. Operators, functions and modules for numeric type


Operators: +,-,*,/,%,//,** Built-ins: abs(), round(), pow(), max(), min() Modules: math, random,
statistics

Q9. Importing module attributes


import math; print([Link](25)) from math import pi; print(pi)

Q10. Define algorithm & properties


Algorithm: stepwise solution. Props: finiteness, input, output, definiteness, effectiveness.

Q11. Difference between algorithm and pseudocode


Algorithm: stepwise logic, language-free. Pseudocode: code-like representation.

Q12. Pseudocode & its characteristics


Informal code written in simple English. Clear, structured, easy to convert, no syntax rules.

Q13. Rules, advantages & disadvantages of pseudocode


Rules: simple words, indentation, logic. Adv: easy to read. Disadv: not executable.

Q14. Flowchart symbols, rules, advantages & disadvantages


Symbols: Oval-start/end, Rectangle-process, Diamond-decision, Arrow-flow. Adv: easy to visualize.
Disadv: hard for big programs.

You might also like