fa
Feedback

فریب کلاهبرداران را نخورید! تل‌متریو این کانال‌ها را شناسایی و برچسب‌گذاری می‌کند 👉 برای مشاهده برچسب، اشتراک تهیه کنید

Leetcode with dani

Leetcode with dani

رفتن به کانال در Telegram

Join us and let's tackle leet code questions together: improve your problem-solving skills Preparing for coding interviews learning new algorithms and data structures connect with other coding enthusiasts

نمایش بیشتر
1 240
مشترکین
-124 ساعت
-37 روز
-1730 روز
آرشیو پست ها
write a program that count number of odd number in the given number. example:- input=3687 .#output=2
09 اکتبر 2023, 02:03

from the comments #in the form of list import random def easy(): lis = [] i = 0 while i < 7:    lis.append(random.randint(1,9))    i+=1 print(lis) easy()
09 اکتبر 2023, 01:47

write a  program that generate 7 random number in the form of  list from one ab to 9.
06 اکتبر 2023, 14:03

n = int(input('number: ')) total = 0 for i in range(2,n,2): print(i) total +=1 print(f'we have {total} even numbers')
06 اکتبر 2023, 14:03

def even(n): ctr=0 for i in range (1,n): if i%2==0: ctr +=1 print(i) print(f“we have {ctr} even numbers”) even(10)
06 اکتبر 2023, 14:03

write a program that generate 7 random number in the form of list from one ab to 9.
06 اکتبر 2023, 13:56
06 اکتبر 2023, ~14:03

use the comment section to give your solution
05 اکتبر 2023, 07:38

#out put 2 4 6 8 we have four even numbers #write a code for the above out put https://t.me/zethioprograming
05 اکتبر 2023, 07:36

here is the solution for the above problem def sum_squared(n): sum=0 while n>0: no=n%10 sum=sum+no**2 n=n//10 print(sum) https://t.me/zethioprograming n=int(input(' ')) sum_squared(n)
05 اکتبر 2023, 02:54

write a code that add the square of each digits in a give number eg:- if the given number is 111 then the out put is 3 if it is 23 the out put is 13.
04 اکتبر 2023, 14:35

here is one way to do the above question n=int(input('number:- ')) if n > 2: for i in range(2,n): if n%i==0: print(n,'is not prime') break else: print(n,'is prime') break elif n ==2: print(n,'is prime') else: print(n,'is not prime')
04 اکتبر 2023, 14:32

write a program that check a given number prime or not?
28 سپتامبر 2023, 06:22

Pydroid 3_6.4_arm_premium.apk53.50 MB
22 سپتامبر 2023, 15:08

pydroid premium
22 سپتامبر 2023, 15:08

11 سپتامبر 2023, 00:53
11 سپتامبر 2023, ~01:11

photo content
06 سپتامبر 2023, 04:16

# examples object-oriented programming (OOP) in Python: Class for a Bank Account: python class BankAccount:     def init(self, account_number, balance=0):         self.account_number = account_number         self.balance = balance             def deposit(self, amount):         self.balance += amount             def withdraw(self, amount):         if self.balance >= amount:             self.balance -= amount         else:             print("Insufficient funds")     def get_balance(self):         return self.balance account = BankAccount("1234", 500) account.deposit(200) print(account.get_balance()) # Prints 700 account.withdraw(800) # Prints "Insufficient funds" Class for a Student: python class Student:     def init(self, name, age, gpa):         self.name = name         self.age = age         self.gpa = gpa     def get_grade(self):         if self.gpa >= 4.0:             return "A"         elif self.gpa >= 3.0:             return "B"         elif self.gpa >= 2.0:             return "C"         else:             return "D"             student = Student("Jim", 19, 3.5) print(student.get_grade()) # Prints "B" Class for a Circle: python from math import pi class Circle:     def init(self, radius):         self.radius = radius     def area(self):         return pi * (self.radius ** 2)     def circumference(self):         return 2 * pi * self.radius circle = Circle(3) print(circle.area()) # Prints 28.274333882308138 print(circle.circumference()) # Prints 18.84955592153876 leave a comment for more clarification
04 سپتامبر 2023, 16:12

some tips for learning object-oriented programming (OOP) in Python as a beginner with examples: 1. Understand the basic concepts: - Classes - user defined blueprint consisting of attributes (data) and methods (functions) - Objects - instances of a class created from the class blueprint - Inheritance - creating a new class from an existing class - Polymorphism - objects can take on different forms and behave in different ways - Encapsulation - binding data and functions together in an object 2. Create a simple class: python class Vehicle:     def init(self, make, model):         self.make = make         self.model = model         def drive(self):         print("Driving", self.model) car = Vehicle("Toyota", "Corolla") car.drive() 3. Use inheritance to create subclasses: python class ElectricVehicle(Vehicle):     def init(self, make, model, battery_size):         super().init(make, model)         self.battery_size = battery_size     def charge_battery(self):         print("Charging battery...") ev = ElectricVehicle("Tesla", "Model 3", 85) ev.charge_battery() 4. Override parent methods: python class ElectricVehicle(Vehicle):     def drive(self):         print("Driving silently!") ev = ElectricVehicle("Tesla", "Model 3", 85) ev.drive() 5. Use encapsulation to restrict access: python class BankAccount:     def init(self, balance=0):         self.balance = balance     def deposit(self, amount):         self.balance += amount     def withdraw(self, amount):         self.balance -= amount     def get_balance(self):         return self.balance account = BankAccount(100) Start with simple examples, and try building up classes of your own. This will help reinforce the concepts.
31 اوت 2023, 03:05

:object-oriented programming (OOP): It is a programming paradigm based on the concept of "objects" that contain data (attributes) and code (methods). Objects are instances of classes, which are like blueprints for creating objects. Classes define what attributes and methods an object has. OOP aims to organize code and model real-world concepts by creating objects that represent those concepts. For example, a Car class with attributes like make, model, year, and methods like drive(), brake(), etc. Encapsulation is a key principle - objects encapsulate their state and code, hiding the internal details from the outside. Access is through well-defined interfaces. Inheritance allows new child classes to be defined that inherit attributes and methods from parent classes, promoting
30 اوت 2023, 08:47