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
poizon [28]
3 years ago
5

one_diff(a?): Description: Determine if there is exactly one character different between exactly two strings. Parameters: Determ

ine these from the description, and the provided examples. Return value: True If there is exactly one character different, False otherwise Example: one_diff("banana", "apple") → False one_diff("need", "reed") → True one_diff("goof", "good") → True one_diff("food", "feed") → False

Computers and Technology
1 answer:
Vladimir79 [104]3 years ago
3 0

Answer:

See explaination

Explanation:

def one_diff(s1,s2):#mthod return true if s1 and s2 has one difference

l1=list(s1)#store characters to list

l2=list(s2)

c=0

if len(l1)!=len(l2):

return False

for i in l1:

if i in l2:#for each character if it is in l1 and l2 continue

continue

else:

c+=1

if c==1:

return True#ret True if cis 1 else False

return False

def exchange(s,*k):#method that exchanges characters

l=list(k)

if len(l)!=0:#check validity of arguments

for i in l:

if i<0 and i+(2*i)>len(s):

res=s

elif i>len(s):

res=s

return res

if len(l)==0:#if no indexes are given

c1=s[0]

c2=s[-1]

res=c2

res=res+s[1:]

res=res[0]+res[1:].replace(c2,c1)

return (res)

elif len(l)==1:#if one index is given

c1=s[l[0]]

c2=s[-1]

res=''

for i in s:

if i==c1 or i==c2:

if i==c2:

res+=c1

else:

res+=c2

else:

res+=i

return (res)

else:#if two indexes are given

c1=s[l[0]]

c2=s[l[1]]

res=''

for i in s:

if i==c1 or i==c2:

if i==c2:

res+=c1

else:

res+=c2

else:

res+=i

return (res)

def is_chain(*k):#method that checks words for one difference

l=list(k)

if len(l)==0:

return False

if len(l)==1:

return True

if len(l)>1:

for i in range(len(l)-1):#for two words in l

if one_diff(l[i],l[i+1]):#call one_diff method

continue

else:

return False

return True

def scramble(s):#method that exchanges characters

i=0

while i<len(s)-1:

s=exchange(s,i,i+1)

i+=2

print(s)

please check out the screenshots in attachment.

You might be interested in
How can I watch you-tube on my school computer without it being blocked on the computer when it uses Lightspeed Systems Relay or
svetlana [45]

Answer:

if u use chrome u can probably look on chrome extensions and search you-tube unblocker and add it to ur chrome

8 0
3 years ago
Why can a "group by" or "order by" clause be expensive to process? What is the difference between a where and having clause?
Zielflug [23.3K]

Answer and Explanation:

Group by clause bunches every one of the information coming back from the question in the predetermined gatherings.  

Order by clause will arrange the information either in rising  or in dropping order depending on the section data or column data.  

It is certainly a lengthy from execution perspective.  

Envision that the quantity of columns returned by the question are millions and gathering and arranging information from this parcel takes bigger execution time.  

The procedure is a lot of equivalent to on the off chance that you are approached to arrange the precisely coordinating names in a populace measurements, it requires colossal measure of handling time to make sense of the precisely coordinating names and after that arranging them as needs be.

The distinction between where and having clause:

'Where' and having clause in SQL are utilized to indicate separating conditions.  

There is a little contrast between these two clause and is given as under:  

WHERE clause is utilized while getting data (lines or rows) from the table, and the information which clears the condition will only be considered into  the result set.

HAVING clause is later utilized to channel a data summary or gathered data.  

On the off chance that the two clauses show up in SQL question, where clause will execute at first and afterward having clause is executed on the groups that returns the group clause.

8 0
4 years ago
A smart card is?
Tom [10]

Answer:

i think....(b)

Explanation:

please say yes or no answer....

8 0
3 years ago
In Word, how can you tell when text is selected?
Anit [1.1K]

Answer:

the text will highlited in gray

Explanation:

5 0
3 years ago
The names of the governing body or organizationds that creates rules for information technology and information communication te
IceJOKER [234]

Answer:

Alliance for Telecommunications Industry Solutions

Explanation:

Alliance for Telecommunications Industry Solutions  is the main body that creates rules for information technology and information communication technology.

This agency create solutions to supports the release of new products and services into the communications marketplace. It also act as an agency that standardizes the  wireless and wireline networks activities. It is accredited by the American National Standards Institute (ANSI).

5 0
3 years ago
Other questions:
  • Windows Hello supports multiple biometric authentication methods, including facial recognition. What is the failsafe method to a
    6·1 answer
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • Ophelia is entering a Get Fit! sporting goods store in a shopping mall when her heel gets caught in a heating grate at the thres
    9·1 answer
  • What are the economic, social, political and cultural effects of the West Indian Day Parade
    12·1 answer
  • Which century saw the development of letterpress printing?
    10·1 answer
  • What does a production proposal provide ?
    7·2 answers
  • Whats th diffence between a fwireless speaker and a wird speakr
    12·1 answer
  • in windows 10, what feature is used to locate and launch software or applications installed on your device?
    8·1 answer
  • Who tryna trade in gta my psn is xMadOrNawx-_-
    11·2 answers
  • What is the destination ip address when an ipv4 host sends a dhcpdiscover message?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!