Posts

File written by this code

import datetime def gettime(): return datetime.datetime.now() def take(k): #1st number code if k==1: print("-----------------------------------") print ("You entered in Aman Health care \n") print("-----------------------------------") c=int(input("enter 1 for ex 2 for health:")) if c==1: value=input("type here\n") with open("aman-ex.txt","a") as op: op.write(str([str(gettime())])+": "+value+"\n") print("File wittern successfully ") elif c==2: print ("\nYou entered in Aman health care ") value=input("type here\n") with open("aman-fd.txt","a") as op: op.write(str([str(gettime())])+": "+value+"\n") print("AMAN EX File wittern successfully ") print("\n\t*****Thanks for visit us*****") #2nd elif k==2: print ("You entered in Preet Health care \n...

Class example

class student: def __init__(self, name, age, city): self.name=name self.age=age self.city=city def print_student(self,greet): print("name is :",self.name) print("age is :",self.age) print("City is :",self.city+ ", "+greet) x,y,z=input("enter name:\n"),input("enter age :\n"),input("enter city \n") print("-----------Detail printed -------------") obj=student(x,y,z) # obj.greet() obj.print_student("\n\t\tThanks you") print("------------------------") # obj=student("Rohan", "28", "LDH") # obj.print_student() # print("------------------------") # obj=student("Mohan", "27", "ASR") # obj.print_student() # print("------------------------") # obj=student("Preet", "29", "MGG") # obj.print_student() # first_name="Ram" # last_name="milan" # age=...

Animated btn

animated Animation Buttons Hover us and enjoy the satisfying neumorphic animation designs! Read More Read More Read More Read More Read More Read More Read More Read More Read More Read More Read More Click! Read More Read More Read More Read More Read More DEERBUCKS.DESIGNING

Python course

free course site Python link Wordpress

factorial_recursive

''' Created on May 29, 2021 @author: Admin ''' # n! = n * n-1 * n-2 * n-3.......1 # n! = n * (n-1)! def factorial_iterative(n): # """ # :param n: Integer # :return: n * n-1 * n-2 * n-3.......1 # """ fac = 1 for i in range(n): fac = fac * (i+1) return fac # def factorial_recursive(n): # """ # :param n: Integer # :return: n * n-1 * n-2 * n-3.......1 # """ # if n ==1: # return 1 # else: # return n * factorial_recursive(n-1) # 5 * factorial_recursive(4) # 5 * 4 * factorial_recursive(3) # 5 * 4 * 3 * factorial_recursive(2) # 5 * 4 * 3 * 2 * factorial_recursive(1) # 5 * 4 * 3 * 2 * 1 = 120 # 0 1 1 2 3 5 8 13 # def fibonacci(n): # if n==1: # return 0 # elif n==2: # return 1 # else: # return fibonacci(n-1)+ fibonacci(n-2) n = int(input("Enter then number...

Nested fun in py

x = "awesome" def myfunc(): global x x = "fantastic" myfunc() print("Python is " + x) ''' Created on May 29, 2021 @author: Admin ''' # l = 10 # Global # # def function1(n): # # l = 5 #Local # m = 8 #Local # global l # l = l + 45 # print(l, m) # print(n, "I have printed") # # function1("This is me") # # print(m) x = 89 def harry(): x = 20 def rohan(): global x x = 87 print("before calling rohan()", x) rohan() print("after calling rohan()", x) harry() # rohan() print(x)

Global Fun in py

''' Created on May 29, 2021 @author: Admin ''' # local variable example # def sum(): # # a=10 #local variable cannot be accessed outside the function # b=20 # sum=a+b # print( sum) # print(a) #this gives an error # sum() #global variable example a=1 def print_Number(): # a=a+1; // cannot edit global variable global a a=5 a=a+1; print(a) print_Number() print(a) #example 2 x = "awesome" def myfunc(): x = "fantastic" print("Python is " + x) myfunc() print("Python is " + x)