Cmput 101_ Assignment python
.pdf
keyboard_arrow_up
School
University of Alberta *
*We aren’t endorsed by this school
Course
101
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
2
Uploaded by SuperPheasant1844
Assignment: Python Programming Challenges
Cmput 101
Objective:
The objective of this assignment is to evaluate your proficiency in programming using the
Python language. This assignment comprises various programming challenges covering Python
fundamentals, data structures, file handling, and object-oriented programming.
Instructions:
Solve all the problems using Python 3.0.
Document your code with comments explaining the logic and functionality.
Submit your solutions in a single Python file (or multiple files if needed), labeled with problem
numbers and corresponding solutions.
Ensure your code runs without errors and produces the expected output for provided test cases.
Original work is expected. Cite external sources used.
Academic Integrity:
Plagiarism or any form of academic dishonesty will not be tolerated. Your work must be original.
Cite any external resources utilized, including books, websites, or discussions with others.
Failure to comply with academic integrity standards will result in consequences as outlined by
University of Alberta.
Problems:
Problem 1: Palindrome Checker (Python)
Write a Python program to check if a given string is a palindrome or not. The program should
accept a string as input and determine whether it's a palindrome.
Problem 2: Sorting Algorithms (Python)
Implement two sorting algorithms (e.g., bubble sort, merge sort) in Python. Compare their
performance (time complexity) for varying input sizes and present results graphically using
libraries like Matplotlib or Seaborn.
Submission Guidelines:
Submit your Python code file(s) with a concise document explaining your approach for each
problem.
Ensure the code adheres to PEP 8 guidelines, has meaningful variable/class names, and
includes proper comments.
Provide test cases and expected outputs for all problems.
Deadline:
The assignment is due by April 6, 2021. Late submissions will be subject to a zero.
Grading:
Evaluation will be based on:
Correctness and efficiency of solutions
Quality of code (readability, structure, comments)
Adherence to submission guidelines
Note:
If you require any clarification or assistance, feel free to ask for help. However, ensure the code
submitted is your own work.
Good luck!
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
Related Questions
Course Level Programming Assignment - Programming a Calculator using Python
In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator.
Objectives
Write a simple Python program that performs arithmetic operations based on the user input
Stage 1: A simple calculator
Your calculator should provide the following arithmetic and control operations.
Arithmetic Operations
Addition (+) add(a,b)
Subtraction (-) subtract(a,b)
Multiplication (*) multiply(a,b)
Division (/) divide(a,b)
Power (^) power(a,b)
Remainder (%) remainder(a,b)
Control Operations
Terminate (#)
Reset ($)
Write a function select_op(choice) to select the appropriate mathematics function based on the users selection.
The behavior of the program should be as follows:
The program should ask the user to specify the desired operation…
arrow_forward
Course Level Programming Assignment - Programming a Calculator using Python
In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator.
Objectives
Write a simple Python program that performs arithmetic operations based on the user input
Stage 1: A simple calculator
Your calculator should provide the following arithmetic and control operations.
Arithmetic Operations
Addition (+) add(a,b)
Subtraction (-) subtract(a,b)
Multiplication (*) multiply(a,b)
Division (/) divide(a,b)
Power (^) power(a,b)
Remainder (%) remainder(a,b)
Control Operations
Terminate (#)
Reset ($)
Write a function select_op(choice) to select the appropriate mathematics function based on the users selection.
The behavior of the program should be as follows:
The program should ask the user to specify the desired operation…
arrow_forward
C programming Debugging
arrow_forward
Direction: Answers must be explained properly and thoroughly. You have to insert a screenshot of the results. Include the observations of your code.
Python download: https://www.python.org/downloads/ Any Python Version 3.8 and later is recommended
arrow_forward
PLEASE CODE IN PYTHON
Problem DescriptionBoring is a type of drilling, specifically, the drilling of a tunnel, well, or hole in the earth. With some recent events, such as the Deepwater Horizon oil spill and the rescue of Chilean miners, the public became aware of the sophistication of the current boring technology. Using the technique known as geosteering, drill operators can drill wells vertically, horizontally, or even on a slant angle.
A well plan is prepared before drilling, which specifies a sequence of lines, representing a geometrical shape of the future well. However, as new information becomes available during drilling, the model can be updated and the well plan modified.Your task is to write a program that verifies validity of a well plan by verifying that the borehole will not intersect itself. A two-dimensional well plan is used to represent a vertical cross-section of the borehole, and this well plan includes some drilling that has occurred starting at (0, −1) and moving…
arrow_forward
Question 2 (18 marks)
This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question.
Important note: you do not need to get a working program in part a. in order to attempt part b.
A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition:
> Convert binary to decimal
>> Input a list of six 1s and 0s corresponding to the binary number to be converted
>> Input a list of six column weightings consisting of powers of two
>> Create a new list that contains the…
arrow_forward
Help me in C#.
arrow_forward
Give proper explanation and don't copy from any websites
arrow_forward
please answer right (python)
arrow_forward
PYTHON
Goal: Create a Python program
Requirements:
Tie it to a real-world topic:
Should be linked to an article, podcast, video, etc. OR
A personal idea for something that is useful/fun for you, your community, etc.
Must use materials from, and restricted to, topics we've covered so far: data/typecasting, console input, formatted output, functions. Specifically:
At least 5 data variables
At least 2 distinct function definitions per group member used in your program in a useful way
Demonstration of some sort of calculation or transformation of data
Console input used in a meaningful way
Formatted output used in a meaningful way
arrow_forward
QUESTION 8
Which of the following are reasons why Python is popular and everyone should consider learning it?
It’s open source, free and widely available with a massive open-source community.
It’s easier to learn than languages like C, C++, C# and Java, enabling novices and professional developers to get up to speed quickly.
It’s easier to read than many other popular programming languages.
All of the above.
QUESTION 9
Which of the following Python Standard Library modules offers additional data structures beyond lists, tuples, dictionaries and sets?
sys and statistics
collections
queue
(b) and (c)
QUESTION 10
What value is produced when Python evaluates the following expression?
5 * (12.7 - 4) / 2
21
21.75
29.5
None of the above.
arrow_forward
Scenario Instructions
You are a Mathematics major who has
agreed to teach an elementary school math
class where the students are studying
geometry. They are just starting to learn
about sine, cosine, and tangent.
You've decided that you want to show the
students what these functions look like when
they have been graphed.
Write a Python program to display three
separate graphs for sin, cos, and tan. Add
the ability to show all three graphs on a
single graph with one row and three
columns.
arrow_forward
Python task:
Task OverviewYour task is to implement a variation of the classic word game Hangman, which involves playersguessing the letters in a word chosen at random with a finite number of guesses. While there arealternate versions such as category Hangman and Wheel of Fortune, which involve playersguessing idioms, places, names and so on, we will be sticking with the traditional version.If you are unfamiliar with the rules of the game, please read the following before starting:http://en.wikipedia.org/wiki/Hangman_(game). You can also play an online version here. Don’tbe intimidated - You’ll be given some skeleton code to get you started, it's easier than it looks!
You will implement a function called main that allows users to play an interactive hangman gameagainst the computer. The computer should pick a word, and players should then try to guess lettersin the word until they win or run out of guesses.Here is the overarching behaviour we expect:1. The program should load a list of…
arrow_forward
4
arrow_forward
PYTHON:
tell the user that if he/she has less than 4 tasks on the to-do list she has time to do more
tell the user that if he/she has more or equal than 6 items she has no room to do more tasks
arrow_forward
Problem Definition: Create and design a program that will accept employee’s information such as employee number, employee name, employee status (T-Tenured / P-Probitionary / C-Contractual), employee position title, basic salary, year end bonus and year hired.
Program Specifications:
Create and design a Menu Option for Employee Information with an ASCII Art.
A Python class/object concept must be apply to perform the following individual method:
Data Entry. Create the Python Methods to accept employee’s information.
Salary Entry. Designed a screen message to accept employee’s salary.
Gross salary = hours worked multiply (160 hrs) by rate per hour
Year End Bonus = Annual Salary * Bonus % (see table below)
Annual Salary = Gross salary multiply by 12 months
Display Information. Designed the employee’s information pay slip.
Consider the following criteria of employees’ salary:
Years of Service
Year Bonus
Employee (rate per hour)
Employee Status
1
10%…
arrow_forward
Programming Language: use Python please
arrow_forward
Give answer fast don't copy anything
arrow_forward
In Python: So this is part of a large project I am working on but I'm having a hard time finding out how to read from one text file and then correct that information to another or same txt file as well as to do it alphabetically. Any help is appreciated. The code I've added was from a previous project that was similar as to what this one wants.
Problem #1: How much should I study outside of class?
Issue:
Your fellow students liked the 2nd version of study hour’s application and want to expand it again by adding the features listed below.
Minimum Study Hours per Week per Class Grade
15 A
12 B
9 C
6 D
0…
arrow_forward
Project 4: PyGame
Assignment Overview
This assignment focuses on the design, implementation and testing of PyGame programs to build games.
Assignment Specifications
Go to Invent with Python, Making Games with Python & PyGame and choose either Chapter 4: Slide Puzzle or Chapter 5: Simulate to complete.
Assignment Note
These chapters have quite a bit more information than the previous projects you have completed but as you have figured out by now, making a game in PyGame is a more lengthy process. You are allowed to use the chapter as a tutorial as to what you need to do to create the game. You are allowed to use the files in the chapter, rather than build the code from scratch. You must then change something in the code to make the game different to create your own remix.
Assignment Deliverable
You must turn in a file called proj04.py – this is your source code solution; be sure to include your names, the project number and comments describing your code.
arrow_forward
In Python please
arrow_forward
c++
We want to build an address book that is capable of storing name, address, Birthday, Email & phone number ofa person. Address book provides functionality in the form of a menu. The feature list includes:• Add – to add a new person record• Delete – to delete an existing person record by name• Search – to search a person record by name· Exit – to exit from application
arrow_forward
Code in C programming only ( not C++ or Java or Python)
BeautifulPath
You are supposed to write production ready code with Proper Unit Test Cases, Modularizaton etc.
You need to write your test cases under user package in test folder. One sample test is created under same
package for reference.
Your code will be evaluated on the basis of code coverage, Code Quality, Best Practices and Bugs.
NOTE: Here, we use CMocka for writing test cases and GCC Compiler.
**PROBLEM:*
Given a directed graph with N nodes and M edges. Each node is associated with lowercase english alphabet.
Beauty of a path is defined as the number of most frequently occurring alphabet.
Find the most beautiful path and return the maximum beauty value it has.
*CONSTRAINTS:*
13->4->5) ie (aaca)
lonut.
Strictly Use the following Function :-
int beauty(int v, int e, String s, int[] x, int[] y)
arrow_forward
Test Analyze Tools Extensions Window Help Search (Ctrl+Q)
Debug Any CPU
Start
File Edit
View
Git Project
Build Debug
2-2
Program.cs* + X
C# Models.cs
I
85
I
}
Model = model;
Year = year;
Status = status; // status
Notes = notes;
89
90
93
94
68 a # 6 8 bo 63 6$་མཁའ་མ8ར8མཚོ ་བའི་་ཝཱ
CarRentalCompany.ProgramA
//public bool avaialble { get; private set; }
O references
public static List CarRent (List rentedVehcile)
{// if the car is available, add to a List that says rented
return rentedvehcile.Where(v => Car.status).ToList();
95
96
97
98
99
}
100
O references
public void CarReturn()
if i
101
{
82%
Output
Show output from: Build
1
Main(string[] args)
Developer PowerShell Package Manager Console Error List Command Window Code Definition Window Output Test Results Test Runs
Ready
81°
myhp
CarRentalCompany
zm
W
Truck.cs
+
Sign in &
Ln: 172
Ch: 6
SPC
CRLF
Qx
Solution Explorer
Live Share
Search Solution Explorer (Ctrl+;) >
Solution 'CarRentalCompany' (1
C# Models.cs
Properties
C*…
arrow_forward
python
- What is the syntax for excluding temperatures that are lower than 0 degrees Celsius?
arrow_forward
CODE USING C++
4. Find the Elephant
by CodeChum Admin
When dealing with problems, it is always best to find the "elephant" in the room. The elephant is basically the biggest issue.
Once this is resolved, it's almost always easier to move forward.
As a therapist, I know how to find the elephant in the room. However, I'm feeling sick today and the next client is coming. Could you please find the elephant for me?
Instructions:
In the code editor, you are provided with a function, findElephant() that accepts a 2D array and returns the largest element in the array. This function has already been implemented so do not edit this.
You are also provided with the 2D array in the main() function.
Your only task is to call the findElephant() function and pass the 2D array, and print the return value.
Output
Elephant:·10
EDIT THIS CODE:
#include <iostream>#include <climits>using namespace std;
int findElephant(int[][100]);
int main(void) { int…
arrow_forward
What are "header files" in programming, and why are they important for including external code libraries?
arrow_forward
python code: There could be more than one copy of a book, and library members should be able to check-outand reserve any copy. We will call each copy of a book, a book item.
arrow_forward
4 & 5 python
arrow_forward
Code the following.
PYTHON PROGRAMMING LANGUAGE ASSIGNMENT
Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list).
Main Function. Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list.
Read Function. The read function should return the contents of the text document as a list.
Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name.?
arrow_forward
CODE USING C++
When dealing with problems, it is always best to find the "elephant" in the room. The elephant is basically the biggest issue.
Once this is resolved, it's almost always easier to move forward.
As a therapist, I know how to find the elephant in the room. However, I'm feeling sick today and the next client is coming. Could you please find the elephant for me?
Instructions:
In the code editor, you are provided with a function, findElephant() that accepts a 2D array and returns the largest element in the array. This function has already been implemented so do not edit this.
You are also provided with the 2D array in the main() function.
Your only task is to call the findElephant() function and pass the 2D array, and print the return value.
Output
Elephant:·10
arrow_forward
Describe the role of header files in programming and their significance in including external code libraries.
arrow_forward
Java Language
Create Clock class and demonstrate the features of the class with the driver program. upload a single file that contains the source code with documentation for both the clock class and the driver and execution of the program. The rule for execution is that you execute enough times with sufficient data that every line in the program is executed).
arrow_forward
i need the program code for it in C++ OOP ( object oriented programming )
arrow_forward
Python Project:
Problem #1: How much should I study outside of class?Issue:Your fellow students liked the previous version of study hour’s application andwant to expand it again by adding the features listed below.Minimum Study Hours per Week per Class Grade15 A12 B9 C6 D0 FProject Specifications:1. The program asks the user their name, employee id, and department.2. The program also asks the user who they are creating the report for, their employeeid, and the department they work in. (hint #1 & 2 are instances of a class – A classmust be created and used within the program)3. The menu driven program has the following options:A. Determine Hours to StudyB. Determine GradeC. Display Averages and TotalsD. QuitThe user can select any menu option in any order they want.For example:o The user can start the program run option A, then option C, then option B,then option D.o They restart the program, run option C, then D.o They restart the program, run option A, then D.o They restart the…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Related Questions
- Course Level Programming Assignment - Programming a Calculator using Python In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator. Objectives Write a simple Python program that performs arithmetic operations based on the user input Stage 1: A simple calculator Your calculator should provide the following arithmetic and control operations. Arithmetic Operations Addition (+) add(a,b) Subtraction (-) subtract(a,b) Multiplication (*) multiply(a,b) Division (/) divide(a,b) Power (^) power(a,b) Remainder (%) remainder(a,b) Control Operations Terminate (#) Reset ($) Write a function select_op(choice) to select the appropriate mathematics function based on the users selection. The behavior of the program should be as follows: The program should ask the user to specify the desired operation…arrow_forwardCourse Level Programming Assignment - Programming a Calculator using Python In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator. Objectives Write a simple Python program that performs arithmetic operations based on the user input Stage 1: A simple calculator Your calculator should provide the following arithmetic and control operations. Arithmetic Operations Addition (+) add(a,b) Subtraction (-) subtract(a,b) Multiplication (*) multiply(a,b) Division (/) divide(a,b) Power (^) power(a,b) Remainder (%) remainder(a,b) Control Operations Terminate (#) Reset ($) Write a function select_op(choice) to select the appropriate mathematics function based on the users selection. The behavior of the program should be as follows: The program should ask the user to specify the desired operation…arrow_forwardC programming Debuggingarrow_forward
- Direction: Answers must be explained properly and thoroughly. You have to insert a screenshot of the results. Include the observations of your code. Python download: https://www.python.org/downloads/ Any Python Version 3.8 and later is recommendedarrow_forwardPLEASE CODE IN PYTHON Problem DescriptionBoring is a type of drilling, specifically, the drilling of a tunnel, well, or hole in the earth. With some recent events, such as the Deepwater Horizon oil spill and the rescue of Chilean miners, the public became aware of the sophistication of the current boring technology. Using the technique known as geosteering, drill operators can drill wells vertically, horizontally, or even on a slant angle. A well plan is prepared before drilling, which specifies a sequence of lines, representing a geometrical shape of the future well. However, as new information becomes available during drilling, the model can be updated and the well plan modified.Your task is to write a program that verifies validity of a well plan by verifying that the borehole will not intersect itself. A two-dimensional well plan is used to represent a vertical cross-section of the borehole, and this well plan includes some drilling that has occurred starting at (0, −1) and moving…arrow_forwardQuestion 2 (18 marks) This question provides an opportunity for you to demonstrate your understanding of the problem-solving approach taught in TM112 and the patterns introduced in Block 1 Part 4 and Block 2 Part 2. You can find an overview of the problem-solving approach and a list of all the patterns TM112 teaches in the Problem solving and Python quick reference and you will need to refer to this document as you work on the question. Important note: you do not need to get a working program in part a. in order to attempt part b. A student wants to design and implement a Python program to convert any 6-bit unsigned binary number to its decimal equivalent. There are many ways of doing this, but here is their initial top-level decomposition: > Convert binary to decimal >> Input a list of six 1s and 0s corresponding to the binary number to be converted >> Input a list of six column weightings consisting of powers of two >> Create a new list that contains the…arrow_forward
- PYTHON Goal: Create a Python program Requirements: Tie it to a real-world topic: Should be linked to an article, podcast, video, etc. OR A personal idea for something that is useful/fun for you, your community, etc. Must use materials from, and restricted to, topics we've covered so far: data/typecasting, console input, formatted output, functions. Specifically: At least 5 data variables At least 2 distinct function definitions per group member used in your program in a useful way Demonstration of some sort of calculation or transformation of data Console input used in a meaningful way Formatted output used in a meaningful wayarrow_forwardQUESTION 8 Which of the following are reasons why Python is popular and everyone should consider learning it? It’s open source, free and widely available with a massive open-source community. It’s easier to learn than languages like C, C++, C# and Java, enabling novices and professional developers to get up to speed quickly. It’s easier to read than many other popular programming languages. All of the above. QUESTION 9 Which of the following Python Standard Library modules offers additional data structures beyond lists, tuples, dictionaries and sets? sys and statistics collections queue (b) and (c) QUESTION 10 What value is produced when Python evaluates the following expression? 5 * (12.7 - 4) / 2 21 21.75 29.5 None of the above.arrow_forwardScenario Instructions You are a Mathematics major who has agreed to teach an elementary school math class where the students are studying geometry. They are just starting to learn about sine, cosine, and tangent. You've decided that you want to show the students what these functions look like when they have been graphed. Write a Python program to display three separate graphs for sin, cos, and tan. Add the ability to show all three graphs on a single graph with one row and three columns.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning