Python Tutorial 5- Let’s Solve Few Questions using Python

  Create function to find if a given year is leap year or not. Provide year as parameter of the function.   def check_leap_year(year): is_leap_year=False if year%4==0: is_leap_year=True try: check_leap_year(2018) print(is_leap_year) except: print(“Your code raised an error”) Create function if a list of years given then find which year is leap year or not. Provide […]

Python Tutorial 4-If Then Else in Python

Conditional statement is most sought after situation in programming. There are many rules and operators get used while using IF THEN ELSE in python. These statement get used when programmer some output based on certain condition or want to perform any function or activity upon any conditional event. Before starting example, we will see some […]

Python Tutorial 3-Index Function in Python

Index Function in Python Index function helps to find the position of specific string in a sentence. In many cases in data, instead of getting complete text value, user want to find and extract specific text from a sentence. In below examples, user want to find the City and Pin code by reading number plate […]

Python Tutorial 2-String Formatting in Python

You want to print “Hello Mr X ” wherein you have created variable name as “Mr X”. name= “Mr X” print(“Hello, %s!” % name) Another example, print ” Mr X is 25 years old” where you have to create extra variable name as Age name= “Mr X” age=25 print(“%s is %d years old ” % […]

Python Tutorial 1-Basic Python Syntax and Commands

Python Tutorial 1-Basic Python Syntax and Commands Comment the line   # program to create variable “user” # Short command in spyder, press CTRL+1 to comment the line   Syntax to create new Variable “user”   user =”Amit” # print to check the output of new variable print(user) Variables Every variable name can consist letters, […]

Code Calibre