Hands-on8
.docx
keyboard_arrow_up
School
Northern Virginia Community College *
*We aren’t endorsed by this school
Course
152
Subject
Computer Science
Date
Feb 20, 2024
Type
docx
Pages
2
Uploaded by ConstableBat2974
Invalid entry: File Edit Shell Debug Options Window Help Python 3.10.10 (tags/v3.10.10:aad5f6éa, Feb 7 2023, 17:20:36) [MSC v.1929 €4 bit (AMD€4)] on win32 a Type "help", "copyright", "credits"™ or "license ()" for more information. ================== RESTART: C:/Users/phanl/Desktop/Handson8.py Enter 1 for Rock, 2 For Paper, 3 for Scissors: 4 Invalid entry. Please try again. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Scissors You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 0 Invalid entry. Please try again. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Rock You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Scissors You lost. Game overfl User wins: 0 Computer wins: 5 Ties: 0 Ln:30 Col: 10 57F . - ] Mostly cloudy Computer wins 5 games: B IDLESh (R[] u] File Edit Shell Debug Options Window Help Type "help”, "copyright", "credits" or "license ()" for more information. N >>> RESTART: C:/Users/phanl/Desktop/Handsons.py Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Rock You tied. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Paper You tied. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Rock You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Scissors You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Paper You won! Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Game over! User wins: 1 Computer wins: 5 Ties: 2 >>> Ln:42 Col: 0 S57°F Mostly cloudy Users wins 5 games:
File Edit Shell Debug Options Window Help You chose Rock The computer chose Rock You tied. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Rock You won'! Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Scissors You won! Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Paper You won! Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Rock You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Paper You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 2 You chose Paper The computer chose Scissors You lost. Enter 1 for Rock, 2 For Paper, 3 for Scissors: 3 You chose Scissors The computer chose Paper You won! Enter 1 for Rock, 2 For Paper, 3 for Scissors: 1 You chose Rock The computer chose Scissors You won! Game over! User wins: § Computer wins: 3 Ties: 2 Ln:50 Cok:0 1118 AM 2/20/2023 AG NG B
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
JAVA
(Baby name popularity ranking) The popularity ranking of baby names from the years 1960s to 2010 are stored in files named babynameranking_1960s.txt, babynameranking_1970s.txt,…, babynameranking_2010s.txt (See the attached zip file). Each file contains two hundred lines. Each line contains a ranking, a boy’s name, a number for the boy’s name, a girl’s name, and a number for the girl’s name. For example, the first two lines in the file babynameranking_2010s.txt are as follows:
1 Noah 182,896 Emma 194,667
2 Liam 173,636 Olivia 184,192
·
So, the boy’s name Noah and the girl’s name Emma are ranked #1 and the boy’s name Liam and the girl’s name Olivia are ranked #2. 182,896 boys are named Noah and 194,667 girls are named Emma in the 2010s. Write a program that prompts the user to enter the year, gender, and followed by a name, and displays the ranking of the name for the year.Example Run of it.
Enter the year: 2010
Enter the gender: M
Enter the…
arrow_forward
Exception in thread "main" java.lang.NumberFormatException: For input string: "x" for Java code
public class Finder {
//Write two recursive functions, both of which will parse any length string that consists of digits and numbers. Both functions
//should be in the same class and have the following signatures.
//use the if/else statement , Find the base case and -1 till you get to base case
//recursive function that adds up the digits in the String
publicstaticint sumIt(String s)
{
//if String length is less or equal to 1 retrun 1.
if (s.length()<= 1){
return Integer.parseInt(s);
}else{
//use Integer.praseInt(s) to convert string to Integer
//returns the interger values
//else if the CharAt(value in index at 0 = 1) is not equal to the last vaule in the string else {//return the numeric values of a char value + call the SumIt method with a substring = 1
return Character.getNumericValue(s.charAt(0) ) + sumIt(s.substring(1));
}
}
//write a recursion function that will find…
arrow_forward
Programming Language Pragmatics, 4th Edition
arrow_forward
JAVA
(Baby name popularity ranking) The popularity ranking of baby names from the years 1960s to 2010 are stored in files
named babynameranking_1960s.txt, babynameranking 1970s.txt,., babynameranking 2010s.txt (See the
attached zip file). Each file contains two hundred lines. Each line contains a ranking, a boy's name, a number for the
boy's name, a girl's name, and a number for the girl's name. For example, the first two lines in the
file babynameranking_2010s.txt are as follows:
1
Noah 182,896 Emma 194,667
2 Liam 173,636 Olivia 184, 192
So, the boy's name Noah and the girl's name Emma are ranked #1 and the boy's name Liam and the girl's name Olivia
are ranked #2. 182,896 boys are named Noah and 194,667 girls are named Emma in the 2010s. Write a program that
prompts the user to enter the year, gender, and followed by a name, and displays the ranking of the name for the year.
Example Run of it.
Enter the year: 2010
Enter the gender: M
Enter the name: John
Boy name John is ranked #26 in…
arrow_forward
Please help me fix my errors in Python.
def read_data(filename): try: with open(filename, "r") as file: return file.read() except Exception as exception: print(exception) return None
def extract_data(tags, strings): data = [] start_tag = f"<{tags}>" end_tag = f"</{tags}>" while start_tag in strings: try: start_index = strings.find(start_tag) + len(start_tag) end_index = strings.find(end_tag) value = strings[start_index:end_index] if value: data.append(value) strings = strings[end_index + len(end_tag):] except Exception as exception: print(exception) return data
def get_names(string): names = extract_data("name", string) return names
def get_descriptions(string): descriptions = extract_data("description", string) return descriptions
def get_calories(string): calories = extract_data("calories", string) return…
arrow_forward
using c++:
Write a class date (d, m, y), class file (name, size, creation_date) and class directory (name, directory_creation_date, array[files])Write the constuctors, destructors, set, get methods for each classCreate a directory object and fill it with its required data
Find the size of the created directory object.
arrow_forward
Python:Look at image!! Thanks
arrow_forward
Not be prepared and not be copy.
arrow_forward
Warning: Not copy code again and again.
N
arrow_forward
Python please
arrow_forward
1-Write a JAVA program that reads an array from input file and invokes twodifferent methods Sort and Max ,that sorts the elements of the array and findsthe Max element and writes out the resulted array in to output file . Usetwo interfaces for methods and throw Exception Handling for Out Of Boundindex for the array
arrow_forward
21.6 LAB PROGRAM GRADE CALCULATOR
in python please
arrow_forward
python:
def engineering_types(majors): ''' Question 5 You are teaching Calculus and want to know what engineering majors are represented in your class based on survey responses.
- Remove any non-engineering majors from the list (in other words, the ones that do not explicitly have "engineering" as the second word) Hint: The word "engineering" may be capitalized in some cases but not in others. Use .lower() or .upper() to check this condition. - Return a list of distinct engineering disciplines present in the list sorted alphabetically.
Args: majors (list) Returns: list
>>> engineering_types(['Electrical engineering', 'Industrial engineering', 'Computer Science', 'Aerospace engineering', 'Industrial Engineering', 'Chemical Engineering', "International affairs", 'Aerospace Engineering']) ['Aerospace', 'Chemical', 'Electrical', 'Industrial']
'''
print(engineering_types(['Electrical…
arrow_forward
C# also I have a error that states cannot open assembly 'debugone4.exe' no such file or directory
arrow_forward
**JAVA DEBUGGING**
The file provided in the code editor to the right contains syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
// Displays five random numbers between
// (and including) user-specified values
import java.util.Scanner;
public class DebugSix4
{
public static void main(String[] args)
{
int high, low, count = 0;
final int NUM = 5;
Scanner input = new Scanner(System.in);
System.out.print("This application displays " + NUM +
" random numbers" +
"\nbetween the low and high values you enter" +
"\nEnter low value now... ");
low = input.nextInt()
System.out.print("Enter high value... ");
high = inputnextInt();
while(low < high)
{
System.out.println("The number you entered for a high number, " +
high + ", is not more than " + low);…
arrow_forward
My First Function
File Edit Shell Debug Opt
Python 3.5.1 (v3.5.1:37a07
Type "copyright", "credits" «
def reuse_code():
comment = input("Type something in")
print(comment)
>>>
Type something inHi
Hi
Type something inHello
Hello
Type something inHowdie
Howdie
reuse_code()*
reuse_code().
reuse_code()
• Listening Activity
arrow_forward
C++ please
arrow_forward
JAVA 8.13 LAB: Movie show time display
Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements:
Each row contains the title, rating, and all showtimes of a unique movie.
A space is placed before and after each vertical separator (|) in each row.
Column 1 displays the movie titles and is left justified with a minimum of 44 characters.
If the movie title has more than 44 characters, output the first 44 characters only.
Column 2 displays the movie ratings and is right justified with a minimum of 5 characters.
Column 3 displays all the showtimes of the same movie, separated by a space.
Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows.
Ex: If the input of the program…
arrow_forward
### Q5: Reduce No Change Python
def reduce_no_change(fn, lst, base):
"""Same as Q4. However, preserve the lst in this problem.
Object can be any python type which the input
Not Allowed To Import Libraries
Args:
fn (function): Combination function which takes in two arguments and return
an value with the same type as the second argument
lst (List): A list of any type
base (Object): A value of custom type which fn can handle.
Returns:
Object: A value after applying fn on lst.
>>> reducer = lambda x, y: x + y
>>> lst = [1, 2, 3]
>>> a = reduce_lst(reducer, lst, 0)
>>> a # a = reducer(reducer(reducer(base, lst[0]), lst[1]), lst[2])
6
>>> lst
>>> [1, 2, 3] # we preserve the list
"""
### Modify your code here
### Modify your code here
arrow_forward
Need help C Programming plz
arrow_forward
RUBY
arrow_forward
C++ PLEASE!!
Working on a project that is about word count with MapReduce, need a file manager class to take care of reading all txt file from a directory with giving path.
The file manager class need to open the directory with the giving path which the user will input, then open the path and open all the txt files in that directory and break the text into single line and pass it to another class to do mapping.
Please help with the file manager class!! Thank you!!
arrow_forward
Note: you must use exceptions and try-catch blocks
arrow_forward
Instruction: 1) Do not change the name of class. 2) Should write each line comments to explain your code. 3) Follow the
guidelines we discussed in our class in submitting programming assignment when you submit via Bb. 4) Use the attached
file in Bb to work on this Lab.
Extend the class (linkedListType and/or unorderedLinkedList) by adding the following operation:
We discussed the function deleteSmallest() as find and delete the first occurred smallest element in a list. In this lab,
we will implement the following function (see (A)) and write a test program to perform several tasks (see (B)).
(A) Find the smallest element appeared in the list. Then, delete all occurrences of the item from the list. Add these
as abstract functions in the class linkedListType and provide the definitions of these functions in the class un-
orderedLinkedList.
(Hint: add the abstract type ( virtual Type detectSmallestElement ()
0:) in the class linkedList Type)
%3D
(B) Write a test program to perform the…
arrow_forward
Java Code:
-Creates ProgramNode, loops over Parse calls correctly, throws exception if unknown item found
-(ParseFunction) Uses MatchAndRemove(), handles any number of parameters, fills in ASTNode correctly
-(ParseAction) Uses MatchAndRemove(), handles any number of parameters, fills in ASTNode correctly
Make sure to give the correct code for parser.java with the screenshots of the output. There must be test cases involved, so make sure to have test cases as well.
arrow_forward
python:
def typehelper(poke_name): """ Question 5 - API
Now that you've acquired a new helper, you want to take care of them! Use the provided API to find the type(s) of the Pokemon whose name is given. Then, for each type of the Pokemon, map the name of the type to a list of all types that do double damage to that type. Note: Each type should be considered individually.
Base URL: https://pokeapi.co/
Endpoint: api/v2/pokemon/{poke_name}
You will also need to use a link provided in the API response.
Args: Pokemon name (str)
Returns: Dictionary of types
Hint: You will have to run requests.get() multiple times!
>>> typehelper("bulbasaur") {'grass': ['flying', 'poison', 'bug', 'fire', 'ice'], 'poison': ['ground', 'psychic']}
>>> typehelper("corviknight") {'flying': ['rock', 'electric', 'ice'], 'steel': ['fighting', 'ground', 'fire']}
"""
# pprint(typehelper("bulbasaur"))#…
arrow_forward
Software engineering case study homework (PLAGIARISM WILL BE DETECTED !!!)
Please provide an upload link for the file
This case study is about a simplified Payphone coin system.1. The minimum price of a communication is 10 ryals.2. After the introduction of the currency, the user has 2 minutes to dial his number (this time iscounted by a time counter).3. The line can be free or busy.4. The Payphone consumes money as soon as the called person picks up and at each time unitgenerated by the counter.5. You can add pieces of money at any time.6. At the time of the hang-up, the balance of the currency introduced (the rest of the money) isreturned.
Required work:From this statement, you are asked to:1. Establish the use case diagram of this statement.2. Construct a sequence diagram that describes the nominal scenario of Payphoning use case inthis statement.
arrow_forward
9- Are there any Syntax Error(s) in this code?
class AAA
{
int x;
int y:
static void Main (string[] args)
{
AAA Obj
6.
new AAA ();
10
a)
No
b)
Yes, lines 3, 4
C)
Yes, lines 3, 4, 9
d)
Yes, lines 3, 4, 6
Boş bırak
123 456 r8
arrow_forward
Java
arrow_forward
** in java language **
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- JAVA (Baby name popularity ranking) The popularity ranking of baby names from the years 1960s to 2010 are stored in files named babynameranking_1960s.txt, babynameranking_1970s.txt,…, babynameranking_2010s.txt (See the attached zip file). Each file contains two hundred lines. Each line contains a ranking, a boy’s name, a number for the boy’s name, a girl’s name, and a number for the girl’s name. For example, the first two lines in the file babynameranking_2010s.txt are as follows: 1 Noah 182,896 Emma 194,667 2 Liam 173,636 Olivia 184,192 · So, the boy’s name Noah and the girl’s name Emma are ranked #1 and the boy’s name Liam and the girl’s name Olivia are ranked #2. 182,896 boys are named Noah and 194,667 girls are named Emma in the 2010s. Write a program that prompts the user to enter the year, gender, and followed by a name, and displays the ranking of the name for the year.Example Run of it. Enter the year: 2010 Enter the gender: M Enter the…arrow_forwardException in thread "main" java.lang.NumberFormatException: For input string: "x" for Java code public class Finder { //Write two recursive functions, both of which will parse any length string that consists of digits and numbers. Both functions //should be in the same class and have the following signatures. //use the if/else statement , Find the base case and -1 till you get to base case //recursive function that adds up the digits in the String publicstaticint sumIt(String s) { //if String length is less or equal to 1 retrun 1. if (s.length()<= 1){ return Integer.parseInt(s); }else{ //use Integer.praseInt(s) to convert string to Integer //returns the interger values //else if the CharAt(value in index at 0 = 1) is not equal to the last vaule in the string else {//return the numeric values of a char value + call the SumIt method with a substring = 1 return Character.getNumericValue(s.charAt(0) ) + sumIt(s.substring(1)); } } //write a recursion function that will find…arrow_forwardProgramming Language Pragmatics, 4th Editionarrow_forward
- JAVA (Baby name popularity ranking) The popularity ranking of baby names from the years 1960s to 2010 are stored in files named babynameranking_1960s.txt, babynameranking 1970s.txt,., babynameranking 2010s.txt (See the attached zip file). Each file contains two hundred lines. Each line contains a ranking, a boy's name, a number for the boy's name, a girl's name, and a number for the girl's name. For example, the first two lines in the file babynameranking_2010s.txt are as follows: 1 Noah 182,896 Emma 194,667 2 Liam 173,636 Olivia 184, 192 So, the boy's name Noah and the girl's name Emma are ranked #1 and the boy's name Liam and the girl's name Olivia are ranked #2. 182,896 boys are named Noah and 194,667 girls are named Emma in the 2010s. Write a program that prompts the user to enter the year, gender, and followed by a name, and displays the ranking of the name for the year. Example Run of it. Enter the year: 2010 Enter the gender: M Enter the name: John Boy name John is ranked #26 in…arrow_forwardPlease help me fix my errors in Python. def read_data(filename): try: with open(filename, "r") as file: return file.read() except Exception as exception: print(exception) return None def extract_data(tags, strings): data = [] start_tag = f"<{tags}>" end_tag = f"</{tags}>" while start_tag in strings: try: start_index = strings.find(start_tag) + len(start_tag) end_index = strings.find(end_tag) value = strings[start_index:end_index] if value: data.append(value) strings = strings[end_index + len(end_tag):] except Exception as exception: print(exception) return data def get_names(string): names = extract_data("name", string) return names def get_descriptions(string): descriptions = extract_data("description", string) return descriptions def get_calories(string): calories = extract_data("calories", string) return…arrow_forwardusing c++: Write a class date (d, m, y), class file (name, size, creation_date) and class directory (name, directory_creation_date, array[files])Write the constuctors, destructors, set, get methods for each classCreate a directory object and fill it with its required data Find the size of the created directory object.arrow_forward
- Python pleasearrow_forward1-Write a JAVA program that reads an array from input file and invokes twodifferent methods Sort and Max ,that sorts the elements of the array and findsthe Max element and writes out the resulted array in to output file . Usetwo interfaces for methods and throw Exception Handling for Out Of Boundindex for the arrayarrow_forward21.6 LAB PROGRAM GRADE CALCULATOR in python pleasearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education