CᴏᴅɪɴɢNᴇʀᴅ 💸🐾
266 subscribers
115 photos
15 files
40 links
༗ हरे कृष्णा ༗
"Lost in my own cosmos 💫 | Coding Need Patience 🥀🐾"

❝Face the failure, Until the Failure fails to face you.❞

— Dreamer

» ChikuX69.netlify.app «

DM ? " @ChikuXBot " : 404;
Download Telegram
print(eval(input("")))
CᴏᴅɪɴɢNᴇʀᴅ 💸🐾
Question 5 : Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: Input: nums = [1, 2, 3, 1] Output: true Example 2: Input: nums = [1, 2, 3, 4] Output: false…
#include <stdio.h>

int check_dual_int(int arr[], int length) {
for (int i = 0; i < length; i++) {
for(int j=i+1; j< length; j++) {
if(arr[i] == arr[j]) {
return 1;
}
}
}
return 0;
}

int main() {
int arr[] = {1, 2, 3, 1};
int length = sizeof(arr) / sizeof(arr[0]);

if(check_dual_int(arr, length) == 1) {
printf("True");
} else {
printf("False");
};
return 0;
}
print(f"{"Boom":_^20}")
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
F-strings usage and formats in Python!

Code Examples:

1. Basic F-string:
name = "Chiku"
age = 21
print(f"Name: {name}, Age: {age}")
# Use code and learn.



2. Debugging:
var = 100
print(f"var={var}")
print(f"{var = }")
# Use code and learn.



3. Rounding:
decimal_number = 1234.5678
percent = 0.5678
print(f"Decimal: {decimal_number:.2f}")
print(f"Percent: {percent:.2%}")
# Use code and learn.



4. Thousands separators:
big_number = 1000000
print(f"Big number: {big_number:,}")
# Use code and learn.



5. Date and time formatting:
import datetime
now = datetime.datetime.now()
print(f"Date: {now:%x}")
print(f"Date and time: {now:%c}")
print(f"Time: {now:%H:%M:%S}")
# Use code and learn.



6. Raw strings:
path = fr"C:\Users\{user}\Documents"
# Use code and learn.
# Do not use in big project, use this format for fun only



7. Alignment:
text = "Chiku"
print(f"{text:>20}") # Right align
print(f"{text:^20}") # Center align
print(f"{text:<20}") # Left align
# Use code and learn.



8. Custom F-string class:
class Text:
def __init__(self, text):
self.text = text

def __format__(self, format_spec):
if format_spec == "upper":
return self.text.upper()
elif format_spec == "lower":
return self.text.lower()
elif format_spec == "count":
return str(len(self.text))
else:
raise ValueError(f"Invalid format specifier: {format_spec}")

text = Text("Chiku")
print(f"{text:upper}")
print(f"{text:lower}")
print(f"{text:count}")
# Use code and learn.
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM