Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy3 /
20121120bExceptions#2Consider the following script. The program reads two numbers from the user, divides the first number with the second, and prints the result. #!/usr/bin/env python3 def main(): while True: num1 = float(input("Number A: ")) num2 = float(input("Number B: ")) result = num1 / num2 print('Result of the division: {0:.2f}'.format(result)) print('-' * 10) ##### if __name__ == "__main__": main() Exercise Complete the program above to treat the following cases:
Advance step by step. Work on one case and test it. If it's OK, move on to the next one. |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |