CSC121 PYTHON Programming Lab

Added on - Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 2 of 4 pages
_______________________________________________________________________CSC121PYTHON PROGRAMMING_______________________________________________________________________LAB 08FUNCTIONS [PART 2]OBJECTIVESIn this lab assignment, students will learn:- What value-returning functions are and how to write them- What return values are and how to send and receive them- How to send multiple return values- How to receive multiple return valuesGOALSIn this lab assignment, students will demonstrate the abilities to:- write value-returning functions- write code to send and receive return values- write code to send multiple return values- write code to receive multiple return valuesINSTRUCTIONANDPROBLEMSWrite a Python program for each of the problems in this lab. You mustorganize your programs such that the input and output follows the format ofthe example output code you are given, if any is provided.Your variable names must follow either thecamel caseorunderscoreconvention, but not both in the same program. Also, their length should be15 characters or less and preferably less than 12:A)Camel case (Java - like):All variables contain either lowercase letters or numeric digits,except when there are multiple words in the variable name.Each word after the first must start with an uppercase letter.Examples:a.numberb.numStudentsc.isValidB)Underscore (C++ - like):
______________________________________________________________________________________________________________________________________________________________________________________________________________________CSC121Lab 08Page2______________________________________________________________________________________________________________________________________________________________________________________________________________________All variables contain either lowercase letters or numeric digits,except when there are multiple words in the variable name.Each word after the first must be separated by an underscorecharacter.Examples:a.numberb.num_studentsc.is_validPlease use PyCharm to type and test your programs. Place all 4 Pythonprogram files (one for each problem) in afoldercalledLab08andzip upthe folder as shown in the Course Resources document calledCreatingSubmittingPythonPrograms. Submit theLab08.zipfile toBlackboard for credit.PROBLEM1Write a program to convert US dollar to Euro. This program has twofunctions:mainand a value-returning functionconvert_to_euro. Please dothe following:(a)In themainfunction,ask userto enter amount in US dollar.(b)In themainfunction, call theconvert_to_eurofunction and pass theamount in US dollar to it.(c)In theconvert_to_eurofunction, write code to convert US dollar toEuro. 1 US dollar is equal to 0.88 Euro. Return the amount in Euro.(d)Themainfunctionreceives and displaysthe amount in Euro.The following is an example.Enter amount in US dollar: 100Equivalent amount in Euro: 88.0Save your Python program in a file freshmen of ABC College must live on campus. Single room is $3000 persemester, while double room is $2000 per semester. There are also twomeal plans to choose. The 21-meal plan serves 21 meals each week withthe price of $3500 per semester. The 15 mean plan serves 15 meals eachweek with the price of $2800 per semester.Write a program for a freshman to choose room type and meal plan. Defineand use the following two functions:
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access