Project Sripts
Project Sripts
def getdate():
import datetime
return datetime.datetime.now()
def log():
a = int(input("Enter 1 for harry, 2 for rohan, 3 for hammad \n"))
if a==1:
b= int(input("type 1 for diet and 2 for exercise \n"))
if b==1:
print(" what did he eat :")
c= input()
with open("harrydiet.txt" , "a") as f:
f.write(c)
print("successfully written")
if b==2:
print(" what did he exercise :")
ex = input()
with open("harryex.txt", "a") as f:
f.write(ex)
print("successfully written")
if a == 2:
b = int(input("type 1 for diet and 2 for exercise\n"))
if b == 1:
print(" what did he eat :")
c = input()
with open("rorhandiet.txt", "a") as f:
f.write(c)
print("successfully written")
if b == 2:
print(" what did he exercise :")
ex = input()
with open("rohanex.txt", "a") as f:
f.write(ex)
print("successfully written")
if a == 3:
b = int(input("type 1 for diet and 2 for exercise \n"))
if b == 1:
print(" what did he eat :")
c = input()
with open("hammaddiet.txt", "a") as f:
f.write(c)
print("successfully written")
if b == 2:
print(" what did he exercise :")
ex = input()
with open("hammadex.txt", "a") as f:
f.write(ex)
print("successfully written")
def retrieve():
a = int(input("Enter 1 for harry, 2 for rohan, 3 for hammad \n "))
if a==1 :
b=int(input("Enter 1 for diet , 2 for exercise\n"))
if b==1 :
with open("harrydiet.txt") as f:
print(getdate(), f.read())
if b==2 :
with open("harryex.txt") as f:
print(getdate(), f.read())
if a==2 :
b=int(input("Enter 1 for diet , 2 for exercise\n"))
if b==1 :
with open("rorhandiet.txt") as f:
print(getdate(), f.read())
if b==2 :
with open("rohanex.txt") as f:
print(getdate(), f.read())
if a==3 :
b=int(input("Enter 1 for diet , 2 for exercise\n"))
if b==1 :
with open("hammaddiet.txt") as f:
print(getdate(), f.read())
if b==2 :
with open("hammadex.txt") as f:
print(getdate(), f.read())
n = int(input("press 0 to log , 1 to retrieve\n"))
if n==0 :
log()
elif n==1 :
retrieve()
--using CTE
with PercentVaccByPop(Continent, location , date,
population,new_vaccinations,RollingVaccinations) as
(select dea.continent , dea.location, dea.date, dea.population, vac.new_vaccinations
, sum(cast(vac.new_vaccinations as int)) over(partition by dea.location order by dea.date) as
RollingVaccinations
from projects..CovidDeaths as dea
join projects..CovidVaccine as vac
on dea.location = vac.location and dea.date = vac.date
where dea.continent is not null
)
select *,(RollingVaccinations/population)*100 as PercentVaccinated from PercentVaccByPop
-- view
create view VaccinatedVsPopulation as
select dea.continent , dea.location, dea.date, dea.population, vac.new_vaccinations
, sum(cast(vac.new_vaccinations as int)) over(partition by dea.location order by dea.date) as
RollingVaccinations
from projects..CovidDeaths as dea
join projects..CovidVaccine as vac
on dea.location = vac.location and dea.date = vac.date
where dea.continent is not null
select*from VaccinatedVsPopulation
create view PercentVaccinated as
with PercentVaccByPop(Continent, location , date,
population,new_vaccinations,RollingVaccinations) as
(select dea.continent , dea.location, dea.date, dea.population, vac.new_vaccinations
, sum(cast(vac.new_vaccinations as int)) over(partition by dea.location order by dea.date) as
RollingVaccinations
from projects..CovidDeaths as dea
join projects..CovidVaccine as vac
on dea.location = vac.location and dea.date = vac.date
where dea.continent is not null
)
select *,(RollingVaccinations/population)*100 as PercentVaccinated from PercentVaccByPop
Python: Snake,Water,Gun
import random
if a == "Gun":
print(f"computer's choice was {a} : You lose")
lose+=1
i=i+1
if x == "w":
if a == "Snake":
print(f"computer's choice was {a} : You lose")
lose += 1
if a == "Water":
print(f"computer's choice was {a} : draw")
draw += 1
if a == "Gun":
print(f"computer's choice was {a} : You win")
win += 1
i=i+1
if x == "g":
if a == "Snake":
print(f"computer's choice was {a} : You win")
win+=1
if a == "Water":
print(f"computer's choice was {a} : You lose")
lose += 1
if a == "Gun":
print(f"computer's choice was {a} : draw")
draw += 1
i=i+1
else:
print("choose correct character")
print("game over")
print(f"your score: {win}")
print(f"computer score: {lose}")
print(f"times you drew: {draw}")
print(draw)
print(lose)