i need this for something else i am working on, so i added it into a more simple code,
what i am trying to do is tell the code that if self.w(the third number) is greater than 20, self.z(the second number) will equal 0(in case the user wants that).
now i want the code to run again with the value the user previously put in, and with self.z = o.
what i am trying to do is tell the code that if self.w(the third number) is greater than 20, self.z(the second number) will equal 0(in case the user wants that).
now i want the code to run again with the value the user previously put in, and with self.z = o.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
class First(): def number_input( self ): self .x = int ( input ( "whats your first number?\n" )) print ( 'your first number is' , self .x) class Second(): def result( self ): self .z = self .x + 2 print ( 'your second number is' , self .z) class Third(): def last_result( self ): self .w = self .z + self .x print ( 'your third number is' , self .w) class if_over(First, Second, Third): def over( self ): if self .w > 20 : yes_no = ( input ( "do you want your second number to equal 0?\n" )) if yes_no = = 'yes' : self .z = 0 obj = if_over() obj.number_input() obj.result() obj.last_result() obj.over() |