0% found this document useful (0 votes)
1 views4 pages

[FA2] - joseph,daniel - Introduction to Python Programming

The document outlines an exercise for students to learn the basics of Python programming, including program structure, literals, variables, and data types. It includes laboratory activities that require students to write Python code to display specific outputs and perform mathematical operations related to salary computation. The exercise aims to enhance students' understanding of Python syntax and programming concepts.

Uploaded by

daniel
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)
1 views4 pages

[FA2] - joseph,daniel - Introduction to Python Programming

The document outlines an exercise for students to learn the basics of Python programming, including program structure, literals, variables, and data types. It includes laboratory activities that require students to write Python code to display specific outputs and perform mathematical operations related to salary computation. The exercise aims to enhance students' understanding of Python syntax and programming concepts.

Uploaded by

daniel
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/ 4

CPE0007L

MODULE 2

EXERCISE

2
INTRODUCTION TO PYTHON PROGRAMMING

STUDENTNAME:Daniel Rudiger P. Joseph

STUDENT NUMBER:202210991

DATE: 14/09/2024

SIGNATURE:
I. OBJECTIVES

At the end of this exercise, students must be able to:


• Understand the python program structure

• Discuss literals, variables and data types

II. BACKGROUND INFORMATION

Simple Python program structure


>>>print (“Hello, World”)
Hello, World
• print () function, allows you to display Strings, numbers and characters. • String
argument “Hello, World” should be enclosed in either double or single quotes
• To create a python file using the .py file extension, and run it in the Command line.
Example: C:\Users>python myprogram.py
III. LABORATORY ACTIVITY
Directions: Write the Python program to display the required output
Write the code here.. Required output

A = “Welcome to Python programming” Welcome to Python programming


print (A)

a = "\nWelcome to Python programming" Welcometo Python


b = "Thank you!" programming Welcome to
Python programming Welcome
print (3 * a)
to Python programming Thank
print (2 * b) you!

Directions: Determine the output of the following program code.


a = “Juan” Juan
print(a) Juan
#double quotes are similar to single
quotes a = ‘Juan’
print(a)

var1, var2, var3 =” Apple”,” Banana”, Apple


“Avocado” Banana
print(var1) Avocadpo
print(var2)

print(var3) Apple
a = b = c = “Apple” Apple
print(a) Apple
print(b)
print(c)

msg=” Nice” Python is Nice


print (“Python is “+ msg)

fname=” Juan ” N/A


lname=”dela Cruz”
msg=fname + lname
B. Create a python program that will perform the following mathematical operations, to produce
the required output.

Given the following values:

Salary_rate=800/day
Salary = Salary_rate * 15 (days)
Taxable_amount = 30% of salary
Net_pay=Salary – Taxable_amount

Required Output:

Salary Computation and Results

Salary rate = 800


Salary = 12000
Taxable amount=3600
Net Pay = 8400

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy