Тёмный
No video :(

*args and **kwargs in python | Lec-22 

MANISH KUMAR
Подписаться 21 тыс.
Просмотров 1,4 тыс.
50% 1

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 24   
@nishantnandgaonkar453
@nishantnandgaonkar453 4 месяца назад
Real time examples while explaining concepts are very important and makes it easy to understand. Thanks manish bhai.
@safiadawood5637
@safiadawood5637 3 месяца назад
Q1: def calculate_sum(*args): total = 0 for num in args: total+= int(num) return total numlist = [] while True: num_input = input ("enter a number ('done' to finish)") if num_input.lower() == 'done': break if num_input.isdigit(): numlist.append(num_input) else: print("Invalid input") result = calculate_sum(*numlist) print("sum of numbers: ", result)
@farahseemi9619
@farahseemi9619 3 месяца назад
Ques1 - def sum_arbitrary_arg(*args): res = 0 for num in args: res+= num return(res) if __name__ == '__main__': numbers = [] n = int(input("enter total numbers")) for i in range(n): number = int(input("enter numbers")) numbers.append(number) result = sum_arbitrary_arg(*numbers) print(result) Ques 2 - def logs(file_handle, **kwargs): for key, value in kwargs.items(): file_handle.write(f"{key}:{value} ") if __name__ == '__main__': with open("logs.txt", "w") as file: logs(file,name = "John", status = "Success", status_code = 200, message ="Done") file.write(" ") logs(file,name = "Jack", status = "Failed", status_code = 100 , message = "insufficient data")
@ankitdhurbey7093
@ankitdhurbey7093 4 месяца назад
def sum(): numbers_to_sum = input('Enter the numbers: ').split() result = 0 for num in numbers_to_sum: result += int(num) return result Final_sum = sum() print(Final_sum)
@abhinavsingh2894
@abhinavsingh2894 2 месяца назад
def logging(**kwargs): with open(file_path, "a") as file1: for key,value in kwargs.items(): file1.write(f"{key} is {value} ") logging(status = 'success',status_code = 200 ,message="Records added to the table") logging(status = 'failed',status_code = 404 ,message="Tables not found")
@VivekKhare-z1m
@VivekKhare-z1m Месяц назад
# Q1. User_input = (input("enter numbers separated by comma")) number_list = User_input.split(',') User_input = tuple(int(num) for num in number_list) def sum(*input): total = 0 for number in input: total += number return total final_result = sum(*User_input) logger.info(final_result) # Q2. user_input = input("enter the input in JSON format") converted_data = json.loads(user_input) file_path = "output.json" def genric_logging(**converted_data): with open(file_path, 'w') as file: for key,value in converted_data.items(): file.write(f"{key}{value}") print(f"Data successfully written to {file_path}") genric_logging(**converted_data)
@ShubhamKumar-cf9ih
@ShubhamKumar-cf9ih 4 месяца назад
thanks for updating "Prommanging Aasan hai" to "Programming Aasan hai" 😄 from the day one it's like "Prommanging aasan hai" 😆
@ankitdhurbey7093
@ankitdhurbey7093 4 месяца назад
Que 2: from datetime import datetime def logging_entry(**kwargs): log_file = open("C:/Users/Desktop/New folder/logs.txt", mode="a") log_file.write(f'{datetime.now} ') for key ,value in kwargs.items(): log_file.write(f'{key} : {value} ') print('Your entry has been made into log file') read_log = open("C:/Users/Desktop/New folder/logs.txt", mode="r") print(read_log.read())
@ankitdhurbey7093
@ankitdhurbey7093 4 месяца назад
While writing current time to text file instead of time i am getting : Can you explain this why i am getting above message
@PranshuHasani
@PranshuHasani 3 месяца назад
@@ankitdhurbey7093 u forgot to add () after datetime.now = datetime.now()
@learnomate
@learnomate 3 месяца назад
Can you please confirm which app you are using for writing purpose 🙏 (black screen )
@manish_kumar_1
@manish_kumar_1 3 месяца назад
Journal++
@sravankumar1767
@sravankumar1767 4 месяца назад
Your explanation is good but u can explain in English. Everyone will see
@codjawan
@codjawan 4 месяца назад
he explains better in his mother tongue, if possible you learn Hindi 😂
@chauhannirav569
@chauhannirav569 4 месяца назад
This course is creating for all.not only you brother so keep watching...no any excuse.
@sravankumar1767
@sravankumar1767 4 месяца назад
@@chauhannirav569 I know this course not only for me I have asked him not you shut your mouth first and focusing on your career ..
@chauhannirav569
@chauhannirav569 4 месяца назад
@@sravankumar1767 sorry brother for the hearting..😔
@manish_kumar_1
@manish_kumar_1 4 месяца назад
@sravankumar I will definitely upload the same in English too but not sure when I will have bandwidth to do that
@deepakrawat418
@deepakrawat418 4 месяца назад
or kitna lectures h bhai
@manish_kumar_1
@manish_kumar_1 4 месяца назад
Av to ye bahut hai. May be more than 20
@deepakrawat418
@deepakrawat418 3 месяца назад
@@manish_kumar_1 bhai i am preparing for Data Engg ,will this whole playlist will be ok
Далее
error handling in python | Lec-23
29:13
Просмотров 1,4 тыс.
AES encryption in python | Lec-25
22:58
Просмотров 1 тыс.
娜美这是在浪费食物 #路飞#海贼王
00:20
Oh No! My Doll Fell In The Dirt🤧💩
00:17
Просмотров 12 млн
configuration file handling in python | Lec-24
35:50
Просмотров 1,3 тыс.
transformation and action in spark
21:58
Просмотров 33 тыс.
tuple in python | Lec-16
31:13
Просмотров 1,1 тыс.
Modern Python logging
21:32
Просмотров 180 тыс.
but what is 'a lifetime?
12:20
Просмотров 70 тыс.
Python Asynchronous Programming - AsyncIO & Async/Await
25:57
The Most Legendary Programmers Of All Time
11:49
Просмотров 553 тыс.