Home > other >  Small white refer to python homework again
Small white refer to python homework again

Time:10-18

CodePudding user response:

Send you a, homework before, give me score



 
The class IntResponder:
"" "
Integer processor
"" "
Def __init__ (self, num) :
The self. The num=num

Def get_type (self) :
"" "the current pending numeric type ", "
The return type (self. Num)

Def is_prime (self) :
"" "is the prime returns True, False number "" "
Return the not (True [in the self. The num % I==0 for I in range (2, and the self. The num)])

Def add_up (self) :
"" "cumulative to the self. The num "","
Return the sum ([x for x in range (1, the self. The num + 1)])

Def multiply_to (self) :
"" "multiplicative to self. The num "" "
The mul=1
For I in range (2, and the self. The num) :
The mul *=I
Return the mul

Def is_odd (self) :
Return (' even if self. Num & amp; 1==0 else "odd")


Def is_num (receive) :
"" is not the integer return False" "" "
The return type (receive) (int) in the


Def help_ () :

Name_dict={
'1', 'digital type'
Whether '2', 'prime',
1 accumulate the number '3' : 'from' and ',
'4' : 'from multiplicative 1 to the number and',
'5' : 'odd or even number',
'6' : 'help'
}
Return (' \ n '. Join (list (item [0] + ' '+ item [1] for the item in name_dict. The items ())))


Def controller () :
"" "process controller "" "
Recv=eval (input (' drops, integer answering machine has started & gt;> '))
If not is_num recv () :
Return 'is not the integer dao what disorderly'

Res=IntResponder recv ()
Recv2=input (' detected Numbers {} please enter \ n {} \ n> operation;> '. The format (recv, help_ ()))

If recv2 not [STR in (I) for I in range (1, 7)] :
Return 'input errors'

Ctl_dict={
'1' : res get_type,
'2' : res is_prime,
'3' : res add_up,
'4' : res multiply_to,
'5' : res is_odd,
'6' : help_
}
Print (ctl_dict [recv2] ())


If __name__=="__main__ ':
The controller ()

CodePudding user response:

reference 1st floor without a white reply:
send you previous homework, give me score



 
The class IntResponder:
"" "
Integer processor
"" "
Def __init__ (self, num) :
The self. The num=num

Def get_type (self) :
"" "the current pending numeric type ", "
The return type (self. Num)

Def is_prime (self) :
"" "is the prime returns True, False number "" "
Return the not (True [in the self. The num % I==0 for I in range (2, and the self. The num)])

Def add_up (self) :
"" "cumulative to the self. The num "","
Return the sum ([x for x in range (1, the self. The num + 1)])

Def multiply_to (self) :
"" "multiplicative to self. The num "" "
The mul=1
For I in range (2, and the self. The num) :
The mul *=I
Return the mul

Def is_odd (self) :
Return (' even if self. Num & amp; 1==0 else "odd")


Def is_num (receive) :
"" is not the integer return False" "" "
The return type (receive) (int) in the


Def help_ () :

Name_dict={
'1', 'digital type'
Whether '2', 'prime',
1 accumulate the number '3' : 'from' and ',
'4' : 'from multiplicative 1 to the number and',
'5' : 'odd or even number',
'6' : 'help'
}
Return (' \ n '. Join (list (item [0] + ' '+ item [1] for the item in name_dict. The items ())))


Def controller () :
"" "process controller "" "
Recv=eval (input (' drops, integer answering machine has started & gt;> '))
If not is_num recv () :
Return 'is not the integer dao what disorderly'

Res=IntResponder recv ()
Recv2=input (' detected Numbers {} please enter \ n {} \ n> operation;> '. The format (recv, help_ ()))

If recv2 not [STR in (I) for I in range (1, 7)] :
Return 'input errors'

Ctl_dict={
'1' : res get_type,
'2' : res is_prime,
'3' : res add_up,
'4' : res multiply_to,
'5' : res is_odd,
'6' : help_
}
Print (ctl_dict [recv2] ())


If __name__=="__main__ ':
The controller ()

Thank you ~ how brother mark?????????

CodePudding user response:

reference 1st floor without a white reply:
send you previous homework, give me score



 
The class IntResponder:
"" "
Integer processor
"" "
Def __init__ (self, num) :
The self. The num=num

Def get_type (self) :
"" "the current pending numeric type ", "
The return type (self. Num)

Def is_prime (self) :
"" "is the prime returns True, False number "" "
Return the not (True [in the self. The num % I==0 for I in range (2, and the self. The num)])

Def add_up (self) :
"" "cumulative to the self. The num "","
Return the sum ([x for x in range (1, the self. The num + 1)])

Def multiply_to (self) :
"" "multiplicative to self. The num "" "
The mul=1
For I in range (2, and the self. The num) :
The mul *=I
Return the mul

Def is_odd (self) :
Return (' even if self. Num & amp; 1==0 else "odd")


Def is_num (receive) :
"" is not the integer return False" "" "
The return type (receive) (int) in the


Def help_ () :

Name_dict={
'1', 'digital type'
Whether '2', 'prime',
1 accumulate the number '3' : 'from' and ',
'4' : 'from multiplicative 1 to the number and',
'5' : 'odd or even number',
'6' : 'help'
}
Return (' \ n '. Join (list (item [0] + ' '+ item [1] for the item in name_dict. The items ())))


Def controller () :
"" "process controller "" "
Recv=eval (input (' drops, integer answering machine has started & gt;> '))
If not is_num recv () :
Return 'is not the integer dao what disorderly'

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related