1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
myrzilka [38]
3 years ago
6

write a function that takes a string as parameter, return true if it’s a valid variable name, false otherwise. You can use keywo

rd module’s iskeyword() to determine if a string is keyword.
Computers and Technology
1 answer:
never [62]3 years ago
8 0

Answer:

The solution code is written in Python 3:

  1. import keyword  
  2. def checkValidVariable(string):
  3.    if(not keyword.iskeyword(string)):
  4.        return True  
  5.    else:
  6.        return False  
  7. print(checkValidVariable("ABC"))
  8. print(checkValidVariable("assert"))

Explanation:

Firstly, we need to import keyword module so that we can use its iskeyword method to check if a string is registered as Python keyword (Line 1).

Next, we create a function checkValidVariable that takes one input string (Line 3). Within the function body, we use iskeyword method to check if the input string is keyword. Please note the "not" operator is used here. So, if iskeyword return True, the True value will be turned to False by the "not" operator or vice versa (Line 4-5).

We test the function by passing two input string (Line 9-10) and we shall get the sample output as follows:

True

False

You might be interested in
In many DBMSs where no strict separation of levels is maintained, this one language is used by the DBA and database designers to
marissa [1.9K]

Answer: False

Explanation:

This means that the mappings between the two schemas may be specified in either one of these languages.In most relational DBMSs today, there is no specific language that performs the role of SDL. Instead, the internal schema is specified by a combination of functions, parameters, and specifications related to storage. These permit the DBA staff to control indexing choices and mapping of data to storage

5 0
3 years ago
The lower an applicant's credit score, the lower the risk to the lender.
ladessa [460]
False your welcomeeeeee
5 0
3 years ago
Write a pseudocode method swap(aList, i, j) that interchanges the items currently in positions i and j of a list. Define the met
serious [3.7K]

Answer:

Explanation:

The following pseudocode for this method using operations of the ADT list would be the following

swap(aList, indexI, indexJ) {

    initialize temp_variable = Retrieve(indexI, aList)

    Insert(Retrieve(indexJ, aList), indexI, aList)

    Insert(Retrieve(indexI, aList), temp_variable, aList)

}

This code basically saves the aList index of i , into a temporary Variable. Then it sets the aList index of i to the value of the element in index of j. Then it does the same for the index of j with the tem_variable. If we assume that the indexes of i and j exist, then it can crash our entire program if those indexes are missing from the list when we try to access them.

6 0
3 years ago
Why would you copy an individual instead of listing that name on the To line?
kvv77 [185]

When you send a letter or an email to somebody in the course
of your job, you might copy your boss.  Even though he really
doesn't need the information in your correspondence, and you
don't expect him to answer you or take any action, you still want
him to know that you're doing your job, and how you're handling
this matter, and you want him to have the information available
IF he wants to see it.

3 0
3 years ago
Read 2 more answers
On an ATM network, how is the path that data will take determined?
Bingel [31]

Answer:

The path that data will take is determined by the switches.

Explanation:-

On ATM(Asynchronous Transfer Mode) Network switches determine the optimal path between the sender and the receiver then establish the path between them before the transmission of data.These  switches with the help of algorithm finds the best route for the data transmission.

3 0
4 years ago
Other questions:
  • You have a Bluetooth headset that integrates with your computer so that you can talk to partners through Microsoft Lync. This is
    6·2 answers
  • What are three ways to call attention to the text on a web page?
    6·2 answers
  • Select the education and qualifications that are most helpful for business analysis careers. Check all that apply
    11·2 answers
  • Which of the following best describes professional behavior in the IT field?
    6·1 answer
  • A or an is a simple chip with two or more processor core
    5·1 answer
  • Viết thuật toán, chương trình xử lý hạn chế trong việc xử lý số liệu phần nguyên để hiển thị lên lcd
    14·1 answer
  • What is the full path and filename for the file on a Debian Linux distribution that displays the time zone settings?
    13·1 answer
  • How does a junction table handle a many-to-many relationship?
    10·1 answer
  • How to code for a database?​
    6·1 answer
  • David plays racing games on his way to work. He uses the analog stick to navigate his vehicle through other artificial intellige
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!