+ 1

Which is best solution for given question?

''' QUESTION: Write a Python program to display your details like name, age, address in three different lines. ''' #solution 1 def personal_details(): name, age = "Simon", 19 address = "Bangalore, Karnataka, India" print("Name: {}\nAge: {}\nAddress: {}".format(name, age, address)) personal_details() # solution 2 n = input(("Enter your name : ")) a = int(input("Enter your age : ")) ad = (input("Enter your address : ")) print("Name : {}\nAge : {}\nAddress :{}".format(n,a,ad)) #which is best for optimization?

7th Feb 2022, 8:17 AM
Sheikh Mohammed Ahmedraza
Sheikh Mohammed Ahmedraza - avatar
0 Resposta