[go: up one dir, main page]

0% found this document useful (0 votes)
20 views6 pages

Lab 3

This document contains the instructions and code snippets for a programming lab exercise. The objective is to take input from the user and control output positioning. The exercises include identifying errors in code snippets, determining the output of code snippets, and writing Python programs to print a student's bio data, suggest food based on user input, and calculate a student's average and percentage based on marks from 5 courses. The student is asked to write the code and output for each problem.

Uploaded by

bilawal khan
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)
20 views6 pages

Lab 3

This document contains the instructions and code snippets for a programming lab exercise. The objective is to take input from the user and control output positioning. The exercises include identifying errors in code snippets, determining the output of code snippets, and writing Python programs to print a student's bio data, suggest food based on user input, and calculate a student's average and percentage based on marks from 5 courses. The student is asked to write the code and output for each problem.

Uploaded by

bilawal khan
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
You are on page 1/ 6

USAMA MEHBOOB 2022F- SE-225 SECTION E

LAB # 03
CONSOLE INPUT AND OUTPUT

OBJECTIVE:
Taking input from user and controlling output position.
EXCERCISE:
A. Point out the errors or undefined/missing syntax, if any, and paste the output also in
the following python programs.
1. print (“Hello\bWorld!”)

CODE:

OUTPUT:

2.first_number = str ( input (“Enter first number”))

second_number = str (input (“Enter second number”))

Sum = (first_number + second_numbe”)

Print (“Addition of two numbers is:”,sum)

CODE:
OUTPUT:

3. age = 23

message = “Happy” + age + “rd Birthday!”

Print (message)

CODE:

OUTPUT:

B. What would be the output of the following programs.


1.a=5

Print (“a =”, a, sep =`0’, end=”,)

CODE:
OUTPUT:

2. name = input(“Enter Employe Name”)

Salary = input (“Enter salary”)

Company = input (“Enter company name”)

Print (“Printing Employee Details”)

Print (“Name”, “Salary”, “Company”)

Print (name, salary, company)

CODE:

OUTPUT:

3. n1=int(input(“enter n1 value’))

N2=int(input(“enter n2 value’))

CODE:
OUTPUT:

C. Write Python programs for the following.


1. Write a program to print a student bio data having his/her Date of Birth, Roll No, Section,
Percentage and grade of matriculation and intermediate. All the fields should be entered from the
console at run time.

CODE:

OUTPUT:

2. Write a program that asks the user what kind of food they would like. Print a message about
that food. Such as “let me see if I can find you a Chowmein”. Food name must be in up
percase.(hint: use upper () for food name)
CODE:

OUTPUT:

3.Take the marks of 5 courses from the user and calculate the average and Percentage, display the
result.

Each course=50 marks

CODE:

OUTPUT:

You might also like