Category : if-statement

Hi please find my code below: def isIn(char, aStr): #char: a single character #aStr: an alphabetized string #returns: True if char is in aStr; False otherwise length=len(aStr) print(length, aStr) #check if length == 0: return False elif length == 1: if char == aStr: return True else: return False elif char==aStr[int(length/2)]: return True elif char<aStr[int(length/2)]: ..

Read more

for i in range(len(words)): ttuple=words[i] # ttuple2=words[i-1] # if ttuple[1]%ttuple2[1]!=0: # bbb=bbb+"n" fish_list = [] read_operation = open(r’C:UserspiotrPycharmProjectsimportDataryby.txt’, encoding="utf-8") lines = read_operation.readlines() for line in lines: fish_list.append(line.strip().casefold()) for fish in fish_list: print(repr(fish)) if fish in ttuple[4]: print("ccccccccccccc"+fish.strip()) print("aaaaaaaaaaa" + str(ttuple[4])) What happend here? When I compare in is like if aaa!=ttuple[4] value if fish is ..

Read more

6 random numbers from 1 to 10(they must be all different) and if the input is in the list of random number "you won" should be printed, but it doesn’t happen. This is what I have: import random numbers=range(1, 11) r=input("Chose your number from 1 to 10 ") a=random.sample(numbers, k=6) print(a) if r in a: ..

Read more

#>>>>>>>>>WHEN VOMITING…… Apply 5C’s if ‘vomiting’ in Pres_Comp: Course_V = input(‘Tell me about the vomiting’ +’….’+’When did the vomiting begin?’) Cause_V = input(‘Any idea what might be responsible for the vomiting?’) dete_P = False if ‘yes’ in Cause_V: dete_cause = input(‘What do you think might be responsible for causing the vomiting? ‘) if ‘poison’ or ..

Read more