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
deff fn [24]
2 years ago
11

Write a Python program, which inputs an identifier/variable name from the user, decides if it is valid or invalid, and then prin

ts out Valid or Invalid.
Rules for identifiers are as follows:
- Can only be a sequence of letters, digits, and underscores
- Must start with letter or underscore
- Must not match with Python key words (if, elif, True, False, and, or, as, for)


This is what I have so far, but am stuck at:

userInput = input("Name: ")

for x in userInput:
if x >= 'a' and x <= 'z':
continue
if x >= 'A' and x <= 'Z':
continue
if x >= '0' and x <= '9':
continue
if x == '_':
continue
else:
valid = false
Computers and Technology
1 answer:
AveGali [126]2 years ago
5 0

Answer:

You can’t use reserved keywords as an identifier name.Python identifier can contain letters in a small case (a-z), upper case (A-Z), digits (0-9), and underscore (_).Identifier name can’t begin with a digit.Python identifier can’t contain only digits.Python identifier name can start with an underscore.There is no limit on the length of the identifier name.Python identifier names are case sensitive.

You might be interested in
Write a JavaScript program to generate the following pattern but the number of rows should be user input.
Nookie1986 [14]

Answer:

Testicles

Explanation:

u sukkk

3 0
3 years ago
Anthony is deciding between different savings accounts at his bank. He has four options, based on how frequently interest compou
leonid [27]
Depends is the answer multiple choice
7 0
4 years ago
Read 2 more answers
How do you change the font in html?<br>&lt;______&gt;google sans"google sans font"&lt;/______&gt;
Allisa [31]
What do you want inside font colour,text,or face
7 0
3 years ago
In windows 10, what is the name of a program you can use to find a file or folder?
Anna007 [38]

Answer:

windows search explorer

3 0
3 years ago
A network technician incorrectly wired switch connections in your organization's network. It effectively disabled the switch as
REY [17]

Answer:

The answer is D. Implement STP or RSTP.

Explanation:

STP (Spanning Tree Protocol) was built to serve as a remedy for network issues. Existing before switches were developed, it works as a substitute for a switch when a switch is wired incorrectly (as seen in the question) or when it fails. STP has two roles:

  1. To serve as an alternative when there is network failure or changes.
  2. To block out issues caused by loops on a network

RSTP (Rapid Spanning Tree Protocol) was built to optimize the standard STP. When there is a topology change, spanning tree convergence is much faster than the standard STP.

To prevent network failure in the future, STP or RSTP should be implemented.

5 0
3 years ago
Other questions:
  • Web storage stores data in the browser in
    5·1 answer
  • ACCOUNTING
    13·2 answers
  • ou work as network administrator for an organization that has a Windows-based network. You want to use multiple security counter
    10·1 answer
  • Which of the following can be considered beta testing? A programmer at Linus Systems checks the integration of multiple modules
    14·1 answer
  • Which of the following commands should you use to determine whether there are any shared resources on a Windows computer with th
    15·2 answers
  • What was ARPANET?
    14·1 answer
  • Write an assembly program that will prompt the user for 3 inputs (let’s abstractly call them a, b, and c) without a leading stri
    13·1 answer
  • 1)Which of the following statements about the print statement are TRUE? (Check all that apply)
    8·1 answer
  • Implement a function called merge that does the following in C#:
    7·1 answer
  • Which of the following is true about overloaded methods?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!