خروج این کد پایتون کدوم گزینه هستش؟
#python #challenge
☕️ @CodeExplore
def mystery_function(lst):
return sorted(set(lst), key=lambda x: (-lst.count(x), x))
sample_list = [3, 1, 2, 2, 3, 3, 1, 4, 4, 4, 4]
result = mystery_function(sample_list)
print(result)
#python #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥6❤🔥3⚡2
خروجی این کد سی شارپ کدوم گزینه هستش؟
#csharp #challenge
☕️ @CodeExplore
using System;
class Program
{
static void Main()
{
int[] numbers = { 1, 2, 3, 4, 5 };
int result = 0;
for (int i = 0; i < numbers.Length; i++)
{
if (i % 2 == 0)
{
result += numbers[i] * numbers[i];
}
else
{
result -= numbers[i];
}
}
Console.WriteLine(result);
}
}
#csharp #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
❤🔥5⚡3🔥2😁1
خروجی کد ++C زیر کدوم گزینه هست؟
#cpp #challenge
☕️ @CodeExplore
#include <iostream>
using namespace std;
void mysteryFunction(int &a, int b) {
a = a * b;
b = a + b;
}
int main() {
int x = 2, y = 3;
mysteryFunction(x, y);
cout << "x = " << x << ", y = " << y << endl;
return 0;
}
#cpp #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡6❤🔥4🔥3
خروجی کد پایتون زیر کدوم گزینه هست؟
#python #challenge
☕️ @CodeExplore
def tricky_function(a, b=[]):
b.append(a)
return b
list1 = tricky_function(1)
list2 = tricky_function(2, [])
list3 = tricky_function(3)
print(list1)
print(list2)
print(list3)
#python #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡5❤🔥3🔥3
خروجی کد جاوااسکریپت کدوم گزینه هست؟
#js #challenge
☕️ @CodeExplore
const value = 0.1 + 0.2;
console.log(value === 0.3);
#js #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥8❤🔥3⚡3😁3
خروجی کد جاوااسکریپت زیر کدوم گزینه هست ؟
#challenge #javascript
@CodeExplore
let foo = null;
console.log(foo === null);
console.log(typeof foo === 'object');
#challenge #javascript
@CodeExplore
🔥11⚡3❤🔥3😁1
خروجی این کد پایتون کدوم گزینست؟
#python #challenge
☕️ @CodeExplore
def compute_value(a, b):
if a % 2 == 0:
result = a * b
if result % 3 == 0:
return result // 3
else:
return result + 3
else:
result = a + b
if result % 5 == 0:
return result // 5
else:
return result - 5
output = compute_value(8, 7)
print(output)
#python #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡12🔥3❤🔥2
خروجی این کد کدوم گزینست؟
a)
15 15 5
20 10 5
b)
15 15 10
30 0 10
c)
15 15 5
25 10 5
d)
20 10 5
30 0 5
#cpp #challenge
☕️ @CodeExplore
#include <iostream>
using namespace std;
void modify(int &x, int &y, int z) {
x += z;
y -= z;
z *= 2;
}
int main() {
int a = 10;
int b = 20;
int c = 5;
modify(a, b, c);
cout << a << " " << b << " " << c << endl;
modify(a, b, c);
cout << a << " " << b << " " << c << endl;
return 0;
}
a)
15 15 5
20 10 5
b)
15 15 10
30 0 10
c)
15 15 5
25 10 5
d)
20 10 5
30 0 5
#cpp #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡9🔥6❤🔥4😁3
خروجی این کد پایتون کدوم گزینست؟
#python #challenge
☕️ @CodeExplore
def mystery_function(n):
if n == 0:
return 0
elif n % 2 == 0:
return mystery_function(n // 2)
else:
return 1 + mystery_function(n // 2)
print(mystery_function(10))
#python #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
❤🔥8⚡3🔥3
سایت HackerRank یک پلتفرم آنلاین برای تمرین و بهبود مهارتهای برنامهنویسی هستش. این سایت شامل چالشهای کدنویسی توی موضوعات مختلف مثل الگوریتمها، پایگاهدادهها، هوش مصنوعی و ریاضیاته. همچنین، HackerRank به کاربرا اجازه میده در مسابقات کدنویسی شرکت کنن و برای آمادهسازی مصاحبههای شغلی از تستهای تکنیکی استفاده کنن.
#programming #challenge
☕️ @CodeExplore
#programming #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡15❤🔥3🔥3
خروجی کد سی شارپ زیر کدوم گزینست؟
#csharp #challenge
@CodeExplore
using System;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
int[] numbers = { 5, 9, 3, 7, 2, 8, 6, 1, 4 };
var result = numbers
.OrderBy(n => n % 2 == 0)
.ThenByDescending(n => n)
.Take(5)
.Sum();
Console.WriteLine(result);
}
}
#csharp #challenge
@CodeExplore
🔥7⚡1❤🔥1
خروجی کد جاوا اسکریپت زیر کدوم گزینست؟
#js #challenge
☕️ @CodeExplore
function mysteryFunction(arr) {
return arr
.filter((x) => x % 2 === 0)
.map((x) => x * x)
.reduce((acc, curr) => acc + curr, 0);
}
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
console.log(mysteryFunction(numbers));#js #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡11❤🔥4🔥3
خروجی کد C زیر کدوم گزینست؟
#clang #challenge
☕️ @CodeExplore
#include <stdio.h>
int main() {
int a = 5, b = 10, c = 15;
int *p1, *p2, *p3;
p1 = &a;
p2 = &b;
p3 = &c;
*p1 += *p3;
*p3 -= *p2;
p2 = p1;
*p2 *= 2;
printf("a = %d, b = %d, c = %d\n", a, b, c);
return 0;
}
#clang #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
⚡8🔥2❤🔥1
خروجی کد جاوااسکریپت زیر کدوم گزینه هست؟
#js #challenge
☕️ @CodeExplore
var a = 1;
function foo() {
if (a) {
var a = 10;
}
console.log(a);
}
foo();
#js #challenge
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥6⚡2❤🔥2
خروجی کد سی شارپ (#C) زیر کدوم گزینست؟
#csharp #challenge
@CodeExplore
using System;
class Program
{
static void Main()
{
int a = 5, b = 3;
bool result = false;
for (int i = 0; i < 3; i++)
{
result = (a > b) && (i % 2 == 0);
a -= 1;
}
Console.WriteLine(result);
}
}
#csharp #challenge
@CodeExplore
❤🔥8🔥3⚡1💔1