Skip to main content

Posts

Showing posts from April, 2021

Comments And Receiving Input in Python - tips4cse

Comments And Receiving Input in Python :  Comments : We use comments to add notes to our code. Good comments explain the hows and whys, not what the code does. That should be reflected in the code itself. Use comments to add reminders to yourself or other developers, or also explain your assumptions and the reasons you’ve written code in a certain way. # This is a comment and it won’t get executed. # Our comments can be multiple lines. Taking User Input: Receiving Input : We can receive input from the user by calling the input() function. birth_year = int ( input ( ‘Birth year: ‘ )) The input() function always returns data as a string. So, we’re converting the result into an integer by calling the built-in int() function.

What Is Variables In Python - tips4cse

 Variables In Python :  Variables : We use variables to temporarily store data in computer’s memory. price = 1.0 rating = 4.9 course_name = ‘Python for Beginners’ is_published = True In the above example, • price is an integer (a whole number without a decimal point) • rating is a float (a number with a decimal point) • course_name is a string (a sequence of characters) • is_published is a boolean. Boolean values can be True or False.