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]
2 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]2 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
Which of the following statements about take home pay is TRUE?
Licemer1 [7]
Banks and other lenders share the credit history of their borrowers with each other and are likely to know of any loan payments that you have missed. Does this answer your question? Plz tell me. If not I am sorry...
8 0
3 years ago
PYTHON:Given the dictionary, d, find the largest key in the dictionary and associate the corresponding value with the variable v
lapo4ka [179]

di = {5: 3, 4: 1, 12: 2}

val_of_max = di[max(di)]

print(val_of_max)

I hope this helps!

4 0
2 years ago
What are html documents also called?
11Alexandr11 [23.1K]
HyperText Markup Language
4 0
2 years ago
In order for a computer to pass the ________, a human should have a conversation with it and not be able to tell if it was a mac
Katena32 [7]

The test that a computer needs to pass after a human's conversation with it and not be able to tell if it was a machine or a human is; Turing Test

<h3>Test of Computers</h3>

The correct answer to the blank portion of the question is Turing test. This is because Turing Test is a test of a computer's ability to exhibit intelligent behavior that is equivalent to, or indistinguishable from, that of a human's behavior.

Finally, If the evaluator cannot reliably tell the computer from the human, the machine is said to have passed the test.

Read more about Test of Computer at; brainly.com/question/21283135

8 0
2 years ago
What are the disadvantages of a server-based network? -lack of centralized network security - need for a network administrator -
tigry1 [53]

Answer:

The server-based network has some disadvantages such as hardware-accelerated which is affordable. Effective operating system with a network. Requires a dedicated system administrator.

Explanation:

  • When one of the databases drops south all the people are being affected and the whole network can even be downgraded.
  • Costlier to set up and maintain.
  • Expensive: - The expensive server hardware equipment, database software platforms, and network installation can require significant source host and system administrator.
  • Administrating:-  Appears to require continual servicing by the system administrator and admin must behave with the relevant skills to preserve also that network infrastructure tracking is an important requirement.
  • Server Failure: - The complete functionality of the system is hosting events. If the server crashes, the whole system will go away even though all the customers rely solely on the computer.
  • Heavy Traffic:- The server is the infrastructure for managing entire elements of the organization that offer the server overload. Internet traffic will be even more relevant as the customer must start their contact session from boot time to disconnect. System routing must be properly maintained otherwise it tends to lead this same computer as a crowded state or the standard processes will be affected.
5 0
3 years ago
Other questions:
  • The quality of a language that allows a programmer to express a computation clearly, correctly, concisely, and quickly is called
    7·1 answer
  • what is the gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    7·2 answers
  • Largest of five (5 points). Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input va
    14·1 answer
  • What is one of the differences between Random Access Memory (RAM) and Read Only Memory (ROM)? RAM is where files are stored, and
    6·2 answers
  • Advantages and disadvantages of technology
    13·1 answer
  • to add data to to a chart, you must format data from another microsoft office product, that automatically opens. whats the name
    10·1 answer
  • Write a string class. To avoid conflicts with other similarly named classes, we will call our version MyString. This object is d
    5·1 answer
  • Edhesive 9.3 code practice
    11·1 answer
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!