Question

A student is running a Python program like this: >python merge.py myfile1.fa myfile2.fa In the merge.py...

A student is running a Python program like this:
>python merge.py myfile1.fa myfile2.fa

In the merge.py program the following lines are present:
import sys
tocheck=sys.argv[1]

What is the value of the variable tocheck?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In python, when we pass command line arguments, the 0th argument is the program name itself. In this case argv[0] = merge.py.

So, the argv[1] will be the myfile1.fa.

And this value is assigned to variable 'tocheck'. So tocheck has the value "myfile1.fa".

Add a comment
Know the answer?
Add Answer to:
A student is running a Python program like this: >python merge.py myfile1.fa myfile2.fa In the merge.py...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What input will successfully validate this program? (Please show exactly how you did it, and what...

    What input will successfully validate this program? (Please show exactly how you did it, and what the input will be to validate it) #!/usr/bin/env python import sys def verify(guess): vals = [        130,        154,        136,        252,        131,        157,        155,        137,        252,        229,        225,        227,        229 ] if len(guess) != 13: return False for i,...

  • In python we often start our code with lines like the following: from scipy import *...

    In python we often start our code with lines like the following: from scipy import * What does the * character mean in this case?

  • I need help with the following When you run it like the following: python3 decorator.py CrocodileLikesStrawberries...

    I need help with the following When you run it like the following: python3 decorator.py CrocodileLikesStrawberries The token "CrocodileLikesStrawberries" allows you to interact with the functions. This code is OK, but there is repetition with the checks for auth_token. We could pull this out into it's own function, but what is even better design is to use a decorator. Create an authorise decorator and use it with the refactored code given below. import sys MESSAGE_LIST = [] @authorise def get_messages():...

  • Python: True or False Questions 1)A Python interpreter is a translator that translates program lines written...

    Python: True or False Questions 1)A Python interpreter is a translator that translates program lines written in other programming languages into Python, one segment at a time. 2)An interpreter executes machine instructions for program lines. s for program lines. 4)A compiler assembles different program lines into a single program, so it can be translated as a whole. 5)A compiler creates machine instructions for a whole program. 6)Translating an entire story from Chinese to English is analogous to compilation 7)An object...

  • Please help with this python assignment. Thank you. question 1 Write a Python program to read...

    Please help with this python assignment. Thank you. question 1 Write a Python program to read a file line by line store it into a variable. question 2 Write a Python program to read a file line by line store it into an array. question 3 Write a python program to find the longest words. question 4 Write a Python program to count the number of lines in a text file. question 5 Write a Python program to count the...

  • Please write comments with the program. Python programming!! Part III - write student data In this...

    Please write comments with the program. Python programming!! Part III - write student data In this part the program should create a .csv file and fill it with generated student information. The program should: Ask the user for a name for the .csv file (use your own name for the exercise) Create the .csv file with columns named - ID, first-name, GPA Based on the information received in part I, generate and fill students information in the CSV file Tell...

  • Python Simple Programming Write a program in Python that calculates the tip and total for a...

    Python Simple Programming Write a program in Python that calculates the tip and total for a meal at a restaurant. When your program is run it should ... Calculate the tip and total for a meal for a restaurant Print the name of the application "Tip Calculator" Get input from the user for cost of meal and tip percent Print the tip and total amounts. The formula for calculating the tip amount is: tip = cost of meal * (tip...

  • For each problem, you must: Write a Python program Test, debug, and execute the Python program...

    For each problem, you must: Write a Python program Test, debug, and execute the Python program Save your program in a .py file and submit your commented code to your Student Page. Note regarding comments: For every class, method or function you create, you must provide a brief description of the what the code does as well as the specific details of the interface (input and output) of the function or method. (25 pts.) Write a program that reads in...

  • write a python program to guess a number between 1 to 9. The user is prompted...

    write a python program to guess a number between 1 to 9. The user is prompted to enter a guess. when the user's guess in not correct, ask them for another guess. when the user guesses the correct number, print "correct" and exit the program #use these two lines to begin the program: from random import randint correctNum=randit(0, 9) #now write a while loop to play the game

  • python Create a program to open a text file for reading, find the maximum number in...

    python Create a program to open a text file for reading, find the maximum number in the file, determine if that maximum number is even, and write to an output text file. You should either write Yes if the number is even, otherwise write the maximum number. You should note the following: • Your input file must be named input.txt • The input file has one integer number per line • Your output file must be named output.txt • Your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT