Model Answer VTU-ADP-18CS55-Feb 2021 Dr. Paras Nath Singh, Professor ...
Model Answer
VTU-ADP-18CS55-Feb 2021
Dr. Paras Nath Singh, Professor(CSE/ISE), 2021-22
1.
a. Demonstrate with example print(), input() and string replication. 6 M
Ans:
The print() function: The print() function displays the string value and value of
the variable inside the parentheses on the screen.
>>> print("sona-sona")
sona-sona
>>> n=20
>>> print("The value of n is",n)
The value of n is 20
The input() function: The input() function waits and reads the entered text by
the user from the keyboard.
>>> name=input("Enter your name :")
Enter your name :Kumar
>>> print("Hi",name)
Hi Kumar
>>> num=int(input("Enter a number : "))
Enter a number : 78
b. Explain elif, for, while, break and continue statements in Python with
examples for each.
10 M
Ans:
elif statement:
The elif statement is an ¡°else if¡± statement that always follows an if or another
elif statement. It provides another condition that is checked only if any of the
previous conditions were False.
Example:
if marks>= 90':
print(You are in A+ grade.')
elif marks>=60:
print('You are passed with first class.')
else:
printf(¡°You are below first class.¡±)
for statement:
for is a looping statement runs for certain number of times and for
number of items in a collection:
for var in range orcollection:
statements
Example
>>> for val in range(10):
print(val,end=' ')
0123456789
>>> for name in ['Ina','Meena','Dika']:
print(name,end=' ')
Ina Meena Dika
while statement:
while is a looping statement under which block of statements execute till
condition is satisfied:
while condition:
statements
Example:
>>> n=13
>>> while n ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 18cs44 model question paper 1 with effect from 2018 19 cbcs scheme
- 18cs53 visvesvaraya technological university
- model question paper 1 with effect from 2019 20 cbcs scheme
- application development using python 18cs55 vtu question paper solutions
- 18cs45 visvesvaraya technological university
- 18cs55 vtu resource syllabus time table question papers results
- 18cs45 model question paper 1 with effect from 2019 20 cbcs scheme
- cmr institute of technology bangalore department s computer science
- model question papers solution
- 18cs55 visvesvaraya technological university
Related searches
- feb 2018 stock market
- feb 19 famous birthdays
- people born on feb 19
- dr singh cardiologist
- dr singh cardiologist las vegas
- dr singh cardiologist louisville ky
- new tv shows feb 2019
- 2019 feb calendar
- audi 2021 model release date
- today in history msn feb 24
- advent health job fair florida feb 11
- feb birthdays of famous people