Reeti Patel

16 posts

Reeti Patel banner
Reeti Patel

Reeti Patel

@CraftWithReeti

Crafter. YT: https://t.co/Cr5i8x1gLg

Katılım Aralık 2023
8 Takip Edilen4 Takipçiler
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv This code checks the value None in an if condition. In Python, None is treated as False, so the if part is skipped. The program then goes to the else part and prints "World".
Reeti Patel tweet media
English
0
1
12
408
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv answer:- error Because the name e is not defined that's why it can't be replaced.
Reeti Patel tweet media
English
0
1
1
10
Reeti Patel
Reeti Patel@CraftWithReeti·
@clcoding This code starts with i = 0 and runs a loop while i < 5. In each step, i increases by 1. When i becomes 3, the continue statement skips the print, so 3 is not shown. All other numbers are printed in one line with spaces. Output: 1 2 4 5
English
0
2
3
50
Python Coding
Python Coding@clcoding·
What will be the output of the following Python code? i = 0 while i < 5: i += 1 if i == 3: continue print(i, end=" ")
English
11
14
91
20.6K
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv This code sets x = 5 and y = 2. The operator ** is used for exponentiation in Python, so x ** y means 5**2 = 25. The Output of this code is 25.
Reeti Patel tweet media
English
0
0
1
13
Reeti Patel
Reeti Patel@CraftWithReeti·
@PythonPr This code makes a list [False, False, False] and uses any() to check if at least one element is True. Since all elements are False, any(my_list) returns False, so the output is False.
Reeti Patel tweet media
English
1
0
1
21
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv Answer:- (D) Error This code has an error because False is a fixed keyword in Python, and you are not allowed to change it with False = True.
English
0
1
2
115
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv This code takes the word "PYTHON" and uses the .center(8, '#') method to make it fit into a space of length 8. Since "PYTHON" has 6 letters, it adds one # on the left and one # on the right to keep it centered.
Reeti Patel tweet media
English
0
0
1
8
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv The string "python" is sliced with [::-2], which means it starts from the end, moves backward, and picks every second character. Reversing "python" gives "nohtyp" Selecting every second character results in "nhy".
Reeti Patel tweet media
English
0
1
4
112
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv Python’s extended iterable unpacking is used. The list [1, 2, 3, 4, 5, 6, 7] is split so that a = 1, b = 2, d = 7 *c collects all the remaining middle values [3, 4, 5, 6].
Reeti Patel tweet media
English
0
1
4
106
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv In Python, * and // have the same precedence and are evaluated from left to right. For a = 2*2//2 first 2*2 = 4 then 4//2 = 2. For b = 3//2*3 first 3//2 = 1 (floor division) then 1*3 = 3. Hence, the final result is 2 3.
Reeti Patel tweet media
English
0
1
4
57
Reeti Patel
Reeti Patel@CraftWithReeti·
@PythonPr X = 8 Y = 2 X = X + 6 X = 14, because X is 8 and adding 6. Y = Y + 6 Y = 8, because Y is 2 and adding 6 . print("y") it is printing lower case 'y' as a string.
Reeti Patel tweet media
English
0
0
1
21
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv Answer : 15 This code checks if x is even or odd using x & 1. If x is even, result becomes y; if odd, result becomes x. x = 12 (even), result = 15(odd).
Reeti Patel tweet media
English
1
0
3
145
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv Simple Addition! 5 + 3 = 8 The output is : 8
Reeti Patel tweet media
English
0
1
2
138
Reeti Patel
Reeti Patel@CraftWithReeti·
@Python_Dv Python unpacks the string into variables . a ,b =12 then, a =1 and b =2 c ,d =34 then, c = 3 Therefore, a,b,c = 1 2 3
Reeti Patel tweet media
English
0
1
3
108
Reeti Patel
Reeti Patel@CraftWithReeti·
@clcoding Answer:24 Explanation !! we import multiplication operator*. We have nums = [1,2,3,4] So it will multiply it Step 1 1*2 = 2 Step 2 2*3 = 6 Step 3 6*4 = 24 24 is the answer.
Reeti Patel tweet media
English
0
1
2
33