Course Content
What is Python?
Introduction of Python and Its setup
0/2
Introduction
Basics Of Python
0/11
Control Statement
Control statements are used to control the flow of execution depending upon the specified condition/logic.
0/4
Collections
0/11
File Handling
File handling is an important component of any application. Python has multiple functions for creating, reading, updating, and deleting files.
0/2
Object Oriented
0/3
Examples
Following are the examples of python scripts to try hands-on, you are ready to start your python journey.
0/7
Private: Python

Control statements are used to control the flow of execution depending upon the specified condition/logic.

1)if- Statement

An if statement is a programming conditional statement that, if the condition is true, it executes the block of code inside of it. ```books = 2
if (books == 2) :
print(" You have")
print("Two books")
print("Outside of if statement") ```

In the above code, we are checking if books is equal to 2, then execute the given code.

2)if-else statement

The if-else statement executes some code if the test expression is true (non-zero) and some other code if the test expression is false. ```a=10
if a<100:
print('less than 100')
else:
print('more than equal 100')```

In the above code, we are checking if a is less than 100, else will print “more than equal 100′.

3)Nested If-Else Statement

The nested if … else statement allows you to check for multiple test expressions and executes different codes for more than two conditions.

```num = float(input("enter a number:"))
if num >=0:
if num==0:
print("zero")
else:
print("Negative number")  ```

In the above code, we are first checking if num is greater than or equal to 0 and then if it is zero if both the conditions are met, “zero” is printed, otherwise “Negative number”.
{"ft_lang_label":"__label__en","ft_lang_prob":0.727487,"math_prob":0.96412206,"size":1220,"snap":"2023-40-2023-50","text_gpt3_token_len":295,"char_repetition_ratio":0.14638157,"word_repetition_ratio":0.06930693,"special_character_ratio":0.26065573,"punctuation_ratio":0.09465021,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9924725,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,3,null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-11-28T19:49:59Z\",\"WARC-Record-ID\":\"<urn:uuid:e8bdcbae-7fce-4f9e-ae54-a87d0e45844b>\",\"Content-Length\":\"130713\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:870a9468-8813-4aef-ad2c-6810f447f242>\",\"WARC-Concurrent-To\":\"<urn:uuid:767e8d71-3a07-4df6-b78a-735f798099d6>\",\"WARC-IP-Address\":\"103.117.212.202\",\"WARC-Target-URI\":\"https://infovistar.in/courses/python/lesson/control-statements/\",\"WARC-Payload-Digest\":\"sha1:WRKTBP5JBWMWNZ3ICQ6RG67LMD2JGXPB\",\"WARC-Block-Digest\":\"sha1:YJNHFS4BU63BYULZU3J4VB3723FSFYVP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679099942.90_warc_CC-MAIN-20231128183116-20231128213116-00249.warc.gz\"}"}