CPSC1280_Lab8+version2-python

.docx

School

Langara College *

*We aren’t endorsed by this school

Course

1280

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

4

Uploaded by KidGrousePerson67

Report
CPSC 1280 – Lab 8 Pre-lab activity a. Login to AWS Cloud9 b. Create a folder, Lab8-yourstudentID Store all your data and work in this folder c. Work independently Problem 1: Simple Calculator Create a program that performs basic arithmetic operations (addition, subtraction, multiplication, division) on two numbers. Requirements: Use variables to store the numbers and the result. The program should ask the user for the numbers and the operation to perform. Sample Output: Enter the first number: 10 Enter the second number: 5 Choose operation (+, -, *, /): + Result: 15 Problem 2: Counting Vowels and Consonants Write a program that counts the number of vowels and consonants in a given string. Requirements: The program should ask the user for a string input. Sample Output: Enter a string: Hello World Number of vowels: 3 Number of consonants: 7 Problem 3: Factorial Calculator Write a function to calculate the factorial of a number. Requirements: The function should take a single argument and return the factorial. Test the function with different numbers. Sample Output: Factorial of 5 is 120 1
CPSC 1280 – Lab 8 Problem 4: Calculate the area and perimeter of a rectangle. Requirements: Use variables for the dimensions of the rectangle and the results. Ask the user for the dimensions. Sample Output: Enter length: 5 Enter width: 10 Area: 50 Perimeter: 30 Problem 5: Read a CSV file containing names and ages and print the names of people older than 20. Requirements: Read from a CSV file. Sample Data: (filename: prob5data.csv ) Name,Age Alice,22 Bob,18 Cathy,25 Sample Output: Alice Cathy Problem 6: Take names and grades from the user and write them to a CSV file. Requirements: Write to a CSV file. Sample Output: (destination filename: prob6data.csv (Sample contents of CSV file and the format) Alice,A Bob,B Problem 7: 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help