Open Tharani2806 opened 8 months ago
Team Name: Team 7 File Name: python 5 Line Number: [11, 12] Bug Description: The bug in the code is that when the ValueError exception occurs (due to entering a non-integer value), the program calls get_number() recursively but does not return the result back to the original caller. To fix this, you need to return the result of the recursive call. Solution: def get_number(): val1 = input('Enter a number: ') try: val1 = int(val1) while val1 < 1 or val1 > 10: val1 = input('Enter a number: ') val1 = int(val1)
return val1
except ValueError:
return get_number()
print(get_number())
Bug Hunt Evaluation: Answer: ((15,),) Correctness: 0/1 Points: 0/100
b"\x0eR?)~gh\x08\x12=\x9e.\x05e\xd21\x80e\xae\xb2J\x01AA\xddE\xee\x99y1\x01\xdf\xbc;*\xc7\xden\xe1\x969|\xae'\x97\xae\x96\xe5\xd0\xbb\xb9v\x15\x96\xa1'&f\xff\xddf\xbd\xd7\x8a\xc9\x99_\xb3\xc3;\t\x9d\xf6\xcd9(:\xee\xea\xb9.\xff\xaaa\x1c\xd4\xc9\xf7\x11\xb4t{gw\xb4|
\xd0dNGE\x1e\x0cv~\xed\x9e98\xe4\x16\xbaO\x8b\x8f\xeb\x17\xff\x01\x03\xba\x93\x8b
\xb7\xf6\n"b'gAAAAABl9SdF6KON7EnIwnU6H7kjYmrZB6YFlmmixvPMRW5A4BUne-11Hk6KopCoLh9UVV3KkiuzK8iXZj557GBfJX_2KD-wn-SI5T-Z1KTxH2CGOmYdYOUVvKrMH1mhj9jbeNHYaob40BaEyRMieHbCDerICWQ29weAJsGu18W7o3tiD1od2z7xlRwei8ZXFatz9__Ceu5-6-1ZBZZMvYWsDH649CfYMgMM5wLhqUrUoq8zBauXR0FnNsuU4aVMOiHc1yQmiTNF1oh1aoNFaaatM84SNUL6tV1a6QTbeVg9mqPVZSxQxqURbfkFe6NWCyXL_kGkELeuQ_nreKc4hNw7XPIXwLT_hXpIBt6xx9m7CaAvYGzhITUw3Guex3fTpRQG_PDz8iWLRO8NsjVCUt7PLXKmjt7E_pt8zy8Q2KDQZ653fSRG5M3fvN0yzPEdNticitNcRymfkI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