SlideShare a Scribd company logo
1 of 6
Download to read offline
MIET MiET SCHOOL
of Engineering
Engineers are driving the future
Python Programming
Tutorial 3
Learn & Lead
Eng. Ruwan Dissanayake
B.Sc.Eng(Hons) Electrical & Electronic Engineer , AMIESL
Former Engineer Corporate Strategy Sri lanka Telecom PLC
Dip.in. Counselling Psychology, Dip.in. Stress Management
Dip.in Buddhist Counselling Psychology(SIBA),
Dip.in Interior Designing, Design in Electrical Installation(IESL)
Certified Motivation Personality & Leadership Trainer
Certified Energy Healing Therapist & Counselor
077 593 10 68 / 071 241 70 27
PRE -ENGINEERING COURSE 2021
MIET MiET SCHOOL
of Engineering
Engineers are driving the future
Tutorial 1-Individual -Python - Variables
1. Write a Python program to input the first and last name of a person and output the full
name.
2. WriteaPythonprogramtoinputtwovaluesandoutputtheadditionofthem.
First name: banu
Second name: dasanayake
banu dasanayake
Input:
Output:
First Number: 25
Second Number: 43
25+43 = 68
Input:
Output:
3. Write a Python script to request the user to enter his name and age and display the details
in the following format. Remember to use comments in your scripts and appropriate
inputandoutputstatements.
Enteryourdetails
-------------------
Firstname:Saman
Lastname:Dasanayaka
Age:25
Hi!IamSamanDasanayakaandIam25yearsold.
4. Write a Python program that will accept the base and height of a triangle and compute the
area.
AreaofaTraiagle
-------------------
Base:12
Hight:8
Area:103
MIET MiET SCHOOL
of Engineering
Engineers are driving the future
5. Write a Python program to compute the future value(maturity Value) of a specified
principalamount,rateofinterest,andanumberofyears.
Input: Amount = 10000,
interest = 3.5
years = 7
Output: Maturity Value : 12722.79
6.WriteaPythonprogramtocalculatebodymassindex.
Input your height in meters: 1.2
Input your weight in Kilogram: 65
Your body mass index is: xxx
Output:
Input:
7.WriteaPythonprogramtoswap twovariables.
a : 20
b: 65
a=65 , b=20
Output:
Input:
MIET MiET SCHOOL
of Engineering
Engineers are driving the future
8.WriteaPythonprogram toconverttemperaturefromFahrenheittoCelsius.
Temp.in Fahrenheit : 50
Temp.in Celsius : 10
Output:
Input:
9.WriteaPythonprogramtoconvertdegreetoradian.
Input:
Output:
Degree : 15
radians: 0.2619047619047619
10.WriteaPythonprogramtoconvertradiantodegree..
Input:
Output:
Radian : 52
Degree: 29.781818181818185
11.WriteaPythonprogramtocalculate volumeandsurfaceareaofacylinder
Input:
Output:
Height : 4
Radius : 6
Volume is : 452.57142857142856
Surface Area is : 377.1428571428571
12. Write a Python program to input the number of electricity units consumed in a building
andoutputthetotalbill.
Input:
Output:
No of Units : 100
Unit Price : 4
Total Bill = Rs 400
MIET MiET SCHOOL
of Engineering
Engineers are driving the future
Special notes
Ÿ Send your code & screenshots of the output as a
single pdf file and do not forget to save your
documentusing yourregistrationnumber.
Ÿ (your Reg.Nois96=> )
96.ME_96_YourName
Ÿ Please submit your assignment to
mietschoolofengineering@gmail.com
13. Write a Python program to compute the distance between the points (x1, y1) and (x2,
14.WriteaPythonprogramtocalculatemidpointsofaline.
15. Write a Python program that accepts an integer (n) and computes the value of
n+(nn)+(nnn)
Input:
Output:
n =5
Value= 615
16.Speedofasinkingobjectinafluidisgivenby
where Ps=density of the object, P =density of the
f
fluid, r =radius of the object, n=viscosity of the
fluid, g=gravitational acceleration and V=speed
t
of the object. Write a Python program to find the
speed of the object when the other units are
given.
MIET MiET SCHOOL
of Engineering
Engineers are driving the future

More Related Content

Similar to 3.Tutorial 3 -Variables.pdf

Irfan'sResume (1)
Irfan'sResume (1)Irfan'sResume (1)
Irfan'sResume (1)Irfan Ali
 
Schematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleSchematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleMoe Moe Myint
 
Major project report
Major project reportMajor project report
Major project reportPraveen Singh
 
Introduction to Embedded C Programming.pdf
Introduction to Embedded C Programming.pdfIntroduction to Embedded C Programming.pdf
Introduction to Embedded C Programming.pdfSanjayKanade3
 
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTION
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTIONAN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTION
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTIONIRJET Journal
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17manjurkts
 
Witsanu_54261522_weekly report(1)
Witsanu_54261522_weekly report(1)Witsanu_54261522_weekly report(1)
Witsanu_54261522_weekly report(1)Witsanu Thamneammai
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 manjurkts
 
OKIDA Electronics Internship Report
OKIDA Electronics Internship ReportOKIDA Electronics Internship Report
OKIDA Electronics Internship ReportCem Recai Çırak
 
ECET 340 Effective Communication/tutorialrank.com
 ECET 340 Effective Communication/tutorialrank.com ECET 340 Effective Communication/tutorialrank.com
ECET 340 Effective Communication/tutorialrank.comjonhson203
 
IRJET - Simulink based Real Time Blood Pressure and Body Tempraure Monitr...
IRJET -  	  Simulink based Real Time Blood Pressure and Body Tempraure Monitr...IRJET -  	  Simulink based Real Time Blood Pressure and Body Tempraure Monitr...
IRJET - Simulink based Real Time Blood Pressure and Body Tempraure Monitr...IRJET Journal
 
Labsheet1 ec303 student
Labsheet1 ec303 studentLabsheet1 ec303 student
Labsheet1 ec303 studentfarah146
 

Similar to 3.Tutorial 3 -Variables.pdf (20)

LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
Irfan'sResume (1)
Irfan'sResume (1)Irfan'sResume (1)
Irfan'sResume (1)
 
Resume
ResumeResume
Resume
 
Schematic and PCB Design Using Eagle
Schematic and PCB Design Using EagleSchematic and PCB Design Using Eagle
Schematic and PCB Design Using Eagle
 
Major project report
Major project reportMajor project report
Major project report
 
Introduction to Embedded C Programming.pdf
Introduction to Embedded C Programming.pdfIntroduction to Embedded C Programming.pdf
Introduction to Embedded C Programming.pdf
 
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTION
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTIONAN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTION
AN AUTONOMOUS ENTRY SYSTEM WITH MASK AND TEMPERATURE DETECTION
 
JM MEHLAPE UPDATE
JM MEHLAPE UPDATEJM MEHLAPE UPDATE
JM MEHLAPE UPDATE
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
KPIT December.pdf
KPIT December.pdfKPIT December.pdf
KPIT December.pdf
 
Witsanu_54261522_weekly report(1)
Witsanu_54261522_weekly report(1)Witsanu_54261522_weekly report(1)
Witsanu_54261522_weekly report(1)
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
OKIDA Electronics Internship Report
OKIDA Electronics Internship ReportOKIDA Electronics Internship Report
OKIDA Electronics Internship Report
 
ECET 340 Effective Communication/tutorialrank.com
 ECET 340 Effective Communication/tutorialrank.com ECET 340 Effective Communication/tutorialrank.com
ECET 340 Effective Communication/tutorialrank.com
 
IRJET - Simulink based Real Time Blood Pressure and Body Tempraure Monitr...
IRJET -  	  Simulink based Real Time Blood Pressure and Body Tempraure Monitr...IRJET -  	  Simulink based Real Time Blood Pressure and Body Tempraure Monitr...
IRJET - Simulink based Real Time Blood Pressure and Body Tempraure Monitr...
 
Python programs
Python programsPython programs
Python programs
 
Cp manual final
Cp manual finalCp manual final
Cp manual final
 
sri resume
sri resumesri resume
sri resume
 
Labsheet1 ec303 student
Labsheet1 ec303 studentLabsheet1 ec303 student
Labsheet1 ec303 student
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 

More from ruwan dissanayake

2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...
2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...
2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...ruwan dissanayake
 
Day 02 -Orthographic drawing.pdf
Day 02 -Orthographic drawing.pdfDay 02 -Orthographic drawing.pdf
Day 02 -Orthographic drawing.pdfruwan dissanayake
 
1.Day 1 Rectilinera Motion Part 01.pdf
1.Day 1 Rectilinera Motion Part 01.pdf1.Day 1 Rectilinera Motion Part 01.pdf
1.Day 1 Rectilinera Motion Part 01.pdfruwan dissanayake
 
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdf
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdfRobotics & Circuit Designing-Eng. Ruwan Dissanayake.pdf
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdfruwan dissanayake
 
Operators: Arithmetic, Comparison, Logical and more
Operators: Arithmetic, Comparison, Logical and moreOperators: Arithmetic, Comparison, Logical and more
Operators: Arithmetic, Comparison, Logical and moreruwan dissanayake
 

More from ruwan dissanayake (7)

2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...
2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...
2.Pre_Engineering_Python Day_02_Miet_School_of_Engineering_Eng.Ruwan_Dissanay...
 
Day 02 -Orthographic drawing.pdf
Day 02 -Orthographic drawing.pdfDay 02 -Orthographic drawing.pdf
Day 02 -Orthographic drawing.pdf
 
Day 01.pdf
Day 01.pdfDay 01.pdf
Day 01.pdf
 
1.Day 1 Rectilinera Motion Part 01.pdf
1.Day 1 Rectilinera Motion Part 01.pdf1.Day 1 Rectilinera Motion Part 01.pdf
1.Day 1 Rectilinera Motion Part 01.pdf
 
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdf
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdfRobotics & Circuit Designing-Eng. Ruwan Dissanayake.pdf
Robotics & Circuit Designing-Eng. Ruwan Dissanayake.pdf
 
Operators: Arithmetic, Comparison, Logical and more
Operators: Arithmetic, Comparison, Logical and moreOperators: Arithmetic, Comparison, Logical and more
Operators: Arithmetic, Comparison, Logical and more
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 

Recently uploaded

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 

Recently uploaded (20)

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 

3.Tutorial 3 -Variables.pdf

  • 1. MIET MiET SCHOOL of Engineering Engineers are driving the future Python Programming Tutorial 3 Learn & Lead Eng. Ruwan Dissanayake B.Sc.Eng(Hons) Electrical & Electronic Engineer , AMIESL Former Engineer Corporate Strategy Sri lanka Telecom PLC Dip.in. Counselling Psychology, Dip.in. Stress Management Dip.in Buddhist Counselling Psychology(SIBA), Dip.in Interior Designing, Design in Electrical Installation(IESL) Certified Motivation Personality & Leadership Trainer Certified Energy Healing Therapist & Counselor 077 593 10 68 / 071 241 70 27 PRE -ENGINEERING COURSE 2021
  • 2. MIET MiET SCHOOL of Engineering Engineers are driving the future Tutorial 1-Individual -Python - Variables 1. Write a Python program to input the first and last name of a person and output the full name. 2. WriteaPythonprogramtoinputtwovaluesandoutputtheadditionofthem. First name: banu Second name: dasanayake banu dasanayake Input: Output: First Number: 25 Second Number: 43 25+43 = 68 Input: Output: 3. Write a Python script to request the user to enter his name and age and display the details in the following format. Remember to use comments in your scripts and appropriate inputandoutputstatements. Enteryourdetails ------------------- Firstname:Saman Lastname:Dasanayaka Age:25 Hi!IamSamanDasanayakaandIam25yearsold. 4. Write a Python program that will accept the base and height of a triangle and compute the area. AreaofaTraiagle ------------------- Base:12 Hight:8 Area:103
  • 3. MIET MiET SCHOOL of Engineering Engineers are driving the future 5. Write a Python program to compute the future value(maturity Value) of a specified principalamount,rateofinterest,andanumberofyears. Input: Amount = 10000, interest = 3.5 years = 7 Output: Maturity Value : 12722.79 6.WriteaPythonprogramtocalculatebodymassindex. Input your height in meters: 1.2 Input your weight in Kilogram: 65 Your body mass index is: xxx Output: Input: 7.WriteaPythonprogramtoswap twovariables. a : 20 b: 65 a=65 , b=20 Output: Input:
  • 4. MIET MiET SCHOOL of Engineering Engineers are driving the future 8.WriteaPythonprogram toconverttemperaturefromFahrenheittoCelsius. Temp.in Fahrenheit : 50 Temp.in Celsius : 10 Output: Input: 9.WriteaPythonprogramtoconvertdegreetoradian. Input: Output: Degree : 15 radians: 0.2619047619047619 10.WriteaPythonprogramtoconvertradiantodegree.. Input: Output: Radian : 52 Degree: 29.781818181818185 11.WriteaPythonprogramtocalculate volumeandsurfaceareaofacylinder Input: Output: Height : 4 Radius : 6 Volume is : 452.57142857142856 Surface Area is : 377.1428571428571 12. Write a Python program to input the number of electricity units consumed in a building andoutputthetotalbill. Input: Output: No of Units : 100 Unit Price : 4 Total Bill = Rs 400
  • 5. MIET MiET SCHOOL of Engineering Engineers are driving the future Special notes Ÿ Send your code & screenshots of the output as a single pdf file and do not forget to save your documentusing yourregistrationnumber. Ÿ (your Reg.Nois96=> ) 96.ME_96_YourName Ÿ Please submit your assignment to mietschoolofengineering@gmail.com 13. Write a Python program to compute the distance between the points (x1, y1) and (x2, 14.WriteaPythonprogramtocalculatemidpointsofaline. 15. Write a Python program that accepts an integer (n) and computes the value of n+(nn)+(nnn) Input: Output: n =5 Value= 615 16.Speedofasinkingobjectinafluidisgivenby where Ps=density of the object, P =density of the f fluid, r =radius of the object, n=viscosity of the fluid, g=gravitational acceleration and V=speed t of the object. Write a Python program to find the speed of the object when the other units are given.
  • 6. MIET MiET SCHOOL of Engineering Engineers are driving the future