Questions for Practice:
- What is Python ? Who created Python?
- What are the features of Python which makes it more popular?
- List out the different jobs available for Python programmer.
- What is the role of programmer? Lis two skills required to become good programmer.
- Discuss, Why Should you learn to write Programs?
- What is Zen of Python?
- Discuss, with snapshots how to install latest version of IDLE Python and Jupyter Python.
- Illustrate with examples how to interact with IDLE Python.
- Explain how mathematical expressions can be executed in interactive shell.
- Illustrate with example how write and execute programs in Jupyter Editor.
- Explain the different components of Jupyter Editor.
- Define Program. Differentiate between Compiler and Interpreter. Give Examples.
- What are Python words and sentences? Explain with an example for each.
- Classify the following list of items into variables, values, operators, strings, and keywords:
List of items: *, + , – , **, < ,> , ‘hello’ , ‘ I am ok . How are you’, -88.8, /, 5, and, is , not , while , for, async, x, si, p , time , rate , velocity , speed, acc , % ,&, ! , || - What are expressions? Illustrate the different types of expressions with examples.
- What are data types? Classify the different data types in python with examples.
- What are Python Variables? What rules one should follow to name the variables.
- Give 5 examples for valid and invalid variables.
- Discuss how to store values in a variable.
- Write a sample program and dissect the program with explanation.
- What are comments? What are the advantages of Comments? Explain the different ways of writing comments.
- Give examples for single and multiline comments.
- Explain the working and usage of print() function with examples.
- Explain the working and usage of input() function with examples.
- Give example to read multiple values using input().
- Define operands and operators. Discuss PEMDAS rules with examples.
- What are keywords? How many keywords are there in current version of Python?
- Write a program to display all keywords in the current version of Python.
- What are Python comments? Explain their importance with programming examples.
- Explain print () , input() and split() functions with example.
- Write a program for the following:
- To read and print a single value in a single line
- To read and print multiple values in a single line
- Explain the following different types of errors: Syntax errors, Semantic errors and Logic Errors.
- Explain the following functions with example:len() , str() , int() , float()
- Predict the out put and justify your answer: (i) -11%9 (ii) 7.7//7 (iii) (200 – 70)10/5 (iv) not “False” (v) 5|**2
- List the rules to describe a variable in Python. Demonstrate at least three different types of variables uses with an example program.
- Explain the following :
- Skills necessary for a programmer
- Interactive Mode
- Short circuit evaluation of expression
- Modulus operator.
- Mention three types of errors encountered in python program.
- Define the following with example : Values and Types , Variables , Expressions , Keywords , Statements , Operators and Operands, Order of Operations , Modulus Operators , String operations and Comments.
- What three functions can be used to get the integer, floating-point number, or string version of a value?
Programs for Practice:
Write and execute python programs for the following :
- To prompt a user for their name and then welcomes them.
- To prompt a user for days and rate per day to compute gross salary.
- To read the following input and display :
a. Name :
b. USN:
c. Roll No:
d. Mobile No:
e. E-Mail Id:
f. Percentage of Marks: - To find the simple interest for a given value of P, T and R. Program should take input from the user.
- To find the compound interest.
- To read two integers and find the sum,diff, mult and div.
- To Convert given Celsius to Fahrenheit temperature.
- To print ascii value of a character.
- To display all the keywords.
- To print the following string in a specific format :””Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are” .
Output :
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
Twinkle, twinkle, little star,
How I wonder what you are - To get a python version.
- To display the current date and time
- To accept the radius of a circle from the user and compute the area.
- To print the calendar of a given month and year.
- To check whether a file exists .
- To determine if a Python shell is executing in 32 bit or 64 bit mode on OS.
- To get OS name , platform and release information .
- To locate Python site packages.
- To call an external command in python.
- To get path and name of the file that is currently executing.
- To parse a string to float or integer.
- To list all files in a directory in Python.
- To print without newline or space.
- To determine profiling of Python programs.
- To print to stderr.
- To access environment variables.
- To get the current username.
- To find the local IP addresses using Pythons stdlib.
- To get execution time for a python method.
- To convert height in meters to centimeters.
- To Convert all units of time to seconds
- To convert the distance in feet to inches , yards and miles.
- To calculate body mass index.
- Given variables x = 15 and y = 30 , write a Python program to print “15+30=45”.
- To get the identity of the object
- To check whether a string is numeric.
- To get the system time .
- To clear the screen or terminal
- To calculate the time runs (difference between start and current time ) of a program.
- To input integer if not generate error.