filmov
tv
python pattern program to print stars in K shape mostly asked question programs

Показать описание
hi friends in this video we printed the pattern K by using python
if you have any doubt please ask me i will try to solve
and please friends subscribe this channel and share this video with your friends
n: in this program we use n variable to hold the number which user give as a input and
int : we use int in this program to convert the user input format into integer format also int() function in Python and Python 3 converts a number in given base to decimal it is used in all the standard conversions. For example conversion of binary to decimal, binary to octal, binary to hexadecimal.
input ( ) : This function first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether user entered a string or a number or list. If the input provided is not correct then either syntax error or exception is raised by python.
after we use for loop to print "*" multiple time
by using for loop we can reduce the length of our program
Python range() function
range() is a built-in function of Python. It is used when a user needs to perform an action for a specific number of times. range() in Python(3.x) is just a renamed version of a function called xrange in Python(2.x). The range() function is used to generate a sequence of numbers.
range() is commonly used in for looping hence, knowledge of same is key aspect when dealing with any kind of Python code. Most common use of range() function in Python is to iterate sequence type (List, string etc.. ) with for and while loop.
Python range() Basics :
Python | Output using print() function
The simplest way to produce output is using the print() function where you can pass zero or more expressions separated by commas. This function converts the expressions you pass into a string before writing to the screen.
Syntax: print(value(s), sep= ‘ ‘, end = ‘\n’, file=file, flush=flush)
Parameters:
value(s) : Any value, and as many as you like. Will be converted to string before printed
sep=’separator’ : (Optional) Specify how to separate the objects, if there is more than one.Default :’ ‘
end=’end’: (Optional) Specify what to print at the end.Default : ‘\n’
flush : (Optional) A Boolean, specifying if the output is flushed (True) or buffered (False). Default: False
if you have any doubt please ask me i will try to solve
and please friends subscribe this channel and share this video with your friends
n: in this program we use n variable to hold the number which user give as a input and
int : we use int in this program to convert the user input format into integer format also int() function in Python and Python 3 converts a number in given base to decimal it is used in all the standard conversions. For example conversion of binary to decimal, binary to octal, binary to hexadecimal.
input ( ) : This function first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether user entered a string or a number or list. If the input provided is not correct then either syntax error or exception is raised by python.
after we use for loop to print "*" multiple time
by using for loop we can reduce the length of our program
Python range() function
range() is a built-in function of Python. It is used when a user needs to perform an action for a specific number of times. range() in Python(3.x) is just a renamed version of a function called xrange in Python(2.x). The range() function is used to generate a sequence of numbers.
range() is commonly used in for looping hence, knowledge of same is key aspect when dealing with any kind of Python code. Most common use of range() function in Python is to iterate sequence type (List, string etc.. ) with for and while loop.
Python range() Basics :
Python | Output using print() function
The simplest way to produce output is using the print() function where you can pass zero or more expressions separated by commas. This function converts the expressions you pass into a string before writing to the screen.
Syntax: print(value(s), sep= ‘ ‘, end = ‘\n’, file=file, flush=flush)
Parameters:
value(s) : Any value, and as many as you like. Will be converted to string before printed
sep=’separator’ : (Optional) Specify how to separate the objects, if there is more than one.Default :’ ‘
end=’end’: (Optional) Specify what to print at the end.Default : ‘\n’
flush : (Optional) A Boolean, specifying if the output is flushed (True) or buffered (False). Default: False