Sale!

CSC/BIF 243 LAB05 Solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (8 votes)

Introduction to Object Oriented Programming
Problem 1

Study this code:

Step 1.
Predict the output of this code.

Step 2.
Type the code into a file named Prob03.py. Run the code.

Step 3.
Understand any discrepancies between your predictions and the actual output.

Note: Nothing to deliver for this problem.
Problem 2

Write a program that reads a line of text and an integer and outputs the first and last word of the line each n times.

Hint: You may want to use the split method.
The split() method splits the string into a list of substrings

Input

Enter a line of text: Hi how are you all in the class
Enter an integer: 3

Output

HiHiHi
classclassclass

Problem 3

Ask the user to enter his/her first name, Last name and ID number and then print 3 lines as follows:

Input

Enter your first name, last name and ID (seperated by a space): Joe Khalife 12345

Output

Hi, my name is first name is Joe
My last name is Khalife
My ID is 12345

Problem 4
Ask the user to enter as many integers as he/she like, separated by spaces, store the numbers in a list. Use list functions and methods to print the list, the number of integers, entered, the sum, the largest, the smallest and how many zeros the list contain.
Input:
Enter as many numbers as you like, separated by spaces: 42 34 0 56 1 3 0
Output:
Your entered: [42, 34, 0, 56, 1, 3, 0]
Your list contains 7 numbers
Sum:136
Smallest:0
Largest: 56
Your List contains 2 zeros

Policy on Cheating and Plagiarism:
Plagiarism on assignments and project work is a serious offense. If plagiarism is detected, a student will be subject to penalty, which ranges from receiving a zero on the assignment concerned to an “F” in the course.