Practice python3 from Zero to ......

1. Write a Python program to print the following string in a specific format.

 

 Hey Dear, we are learning,
        python 3.10 is a latest versin.
                Don't give up, it's take time,
                Keep going, no others ways to go.
what is impossible,
nothing is imposible. Anything is posible.

 

sol:


print("Hey Dear, we are learning,\n \tpython 3.10 is a latest versin. \n \t \tDon't give up, it's take time,\n \t \tKeep going, no others ways to go.\nwhat is impossible,\nnothing is imposible. Anything is posible.")



 

2. Write a Python program to get the version you are using of python.

└─$ python3 -V                    
Python 3.9.7




3. Display the current date and time



import datetime
now = datetime.datetime.now()
print("Current time and date")
print(now.strftime("%H:%M:%S \n%d-%-m-%y"))

output:
    Current time and date
    19:40:23
    29-12-20
 



4. Tell the output

 
    a = 15
a = "python"
print(a)

output:




5.  what is the output:

xx = 15

if True:
xx = 25
print(xx)






. what is the output:


    a = 75
    def var_test():
    return (a)
    print(var_test())
 
إرسال تعليق (0)
أحدث أقدم