es
Feedback
Python Questions

Python Questions

Ir al canal en Telegram

Tasks for Beginners, Interview Questions, Regular expressions, simple coding problems, Quiz etc. Useful Resources — »»» @python_resources_iGnani Projects for Practice — »»» @python_projects_repository Discussion Forum — »»» @python_programmers_club

Mostrar más
El país no está especificadoLa categoría no está especificada
5 285
Suscriptores
Sin datos24 horas
Sin datos7 días
Sin datos30 días
Archivo de publicaciones
PyTip for the day: Use the "enumerate" function to iterate over a sequence and get the index of each element. Sometimes when you're iterating over a list or other sequence in Python, you need to keep track of the index of the current element. One way to do this is to use a counter variable and increment it on each iteration, but this can be tedious and error-prone. A better way to get the index of each element is to use the built-in "enumerate" function. The "enumerate" function takes an iterable (such as a list or tuple) as its argument and returns a sequence of (index, value) tuples, where "index" is the index of the current element and "value" is the value of the current element. Here's an example:
 Iterate over a list of strings and print each string with its index
strings = ['apple', 'banana', 'cherry', 'date']
for i, s in enumerate(strings):
    print(f"{i}: {s}")

In this example, we use the "enumerate" function to iterate over a list of strings. On each iteration, the "enumerate" function returns a tuple containing the index of the current string and the string itself. We use tuple unpacking to assign these values to the variables "i" and "s", and then print out the index and string on a separate line. The output of this code would be:
 apple
1: banana
2: cherry
3: date

Using the "enumerate" function can make your code more concise and easier to read, especially when you need to keep track of the index of each element in a sequence.

:= which of the following is true about this operator
Anonymous voting

What does HttpResponse do in Django?
Anonymous voting

Select the command that installs Django?
Anonymous voting

``` print('The sum of {0} and {1} is {2}'.format(5, 10, 15)) ``` What is the output?
Anonymous voting

print('pyypyypypyppy'.replace('py', 'iG', 3)) #What is the output?
Anonymous voting

print('iGnani'.translate({'i': '1', 'G': '2', 'n': '3', 'a': '4', 'i': '5'})) #What is the output. Explain translate()
Anonymous voting

print('KLM'.maketrans('KLM', '123')) What is the output? Explain the function maketrans()
Anonymous voting

print(r"\npython") #What is the output? Explain Why?
Anonymous voting

x = (round(4.5) - round(-4.5)) #What is the value of x
Anonymous voting

print('1.1'.isnumeric()) #What is the output? Explain this.
Anonymous voting

print('xy'.isalpha()) #What is the output of the above code?
Anonymous voting

x = “python”+1+2+3 # What is the value of x? Explain?
Anonymous voting

print("abbcabcacabb".count('abb', 2, 11)) #What is the output of the above statement? Explain this statement?
Anonymous voting

https://t.me/python_interview_questions/117 Only 14% got this correct.
 
True, False and None are capitalized, that is the first letter in these keywords start with a Capital letter.
The rest of all the other keywords are in lower case.
Hence, the correct answer is "
None of the above
".

print('*', "abcdef".center(7), '*') # What is the output? Can you Explain?
Anonymous voting

x = "Python World" x[3] = 's' # What is the value of x? Can you explain Why?
Anonymous voting

x, y = 5, 6 x+y == _____ #Which of the following statements is equal to x+y?
Anonymous voting

x=1.23456789 '%f | %e | %g' %(x, x, x) #What is the result? Explain Why?
Anonymous voting

x = [1, 23, 'hello', 1] type(x) # What datatype of x? Explain?
Anonymous voting