This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ATM | |
def deposit(): | |
amount=int(input("enter the amount you want to deposit")) | |
global balance | |
balance=balance+amount | |
def withdraw(): | |
amount=int(input("enter the amount you want to withdraw")) | |
global balance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def compare(player1,player2): | |
if player1==player2: | |
print(f"Draw the dice number is {player1}\n") | |
elif player1>player2: | |
print("player1 wins") | |
print(f"player1 number is: {player1} and player2 number is: {player2}") | |
global player1_wins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
while True: | |
print("This is a dice rolling program") | |
print("Press Enter to roll") | |
input() | |
Number=random.randint(1,6) | |
if Number==1: | |
print("[*************************]") | |
print(" ") | |
print(" o ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
no_of_leaves=5 | |
def __init__(self,name,salary,role): | |
self.name=name | |
self.salary=salary | |
self.role=role | |
def printdetail(self): | |
return f"name is {self.name}.Salary is {self.salary}.Role is {self.role}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
no_of_leaves=5 | |
def __init__(self,name,salary,role): | |
self.name=name | |
self.salary=salary | |
self.role=role | |
def printdetail(self): | |
return f"name is {self.name}.Salary is {self.salary}.Role is {self.role}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ATM | |
def deposit(): | |
amount=int(input("enter the amount you want to deposit")) | |
global balance | |
balance=balance+amount | |
def withdraw(): | |
amount=int(input("enter the amount you want to withdraw")) | |
global balance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
no_of_leaves=9 | |
def __init__(self,aname,asalary,arole): | |
self.name=aname | |
self.salary=asalary | |
self.role=arole | |
def printable(self): | |
return f"name:{self.name} salary:{self.salary} role:{self.role}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
no_of_leaves=9 | |
def __init__(self,aname,asalary,arole): | |
self.name=aname | |
self.salary=asalary | |
self.role=arole | |
def printable(self): | |
return f"Name of the employeer is {self.name} and his work as a {self.role} and having salary {self.salary}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
no_of_leaves=8 #class variable | |
def __init__(self,aname,asalary,arole): | |
self.name=aname | |
self.salary=asalary | |
self.role=arole | |
def printable(self): | |
return f"Name is {self.name} and salary is {self.salary} and role is {self.role}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#map,filter,reduce | |
#reduce | |
import functools | |
lst=[1,2,4,54,5,6] | |
num=functools.reduce(lambda x,y:x+y,lst) | |
print(num) |
NewerOlder