-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic.py
85 lines (80 loc) · 1.71 KB
/
basic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
a=10
b=20
c=a+b
print(c)
total=0
for i in range(10):
total=total+i
print(total)
thisdict={'size':'fat','color':'black','year':1999}
print(thisdict)
n=thisdict['movie']='bahubali'
print(n)
thisdict.update({'color':'black'})
print(thisdict)
del thisdict['size']
print(thisdict)
list=['apple','cake','banana']
print(list)
l=['abc',1,2,'True']
l.append('apple')
l.insert(-2,'cat')
l.remove('apple')
print(l)
k=('apple','cat','elephant')
print(type(k))
print(id(k))
t=['123']+['apple','orange']
print(t)
print('alice'*5)
print('alice'+'bob')
s='dox'
print(s*2)
p='aliya'
print(p+'dad')
import random,sys
print('rock','papaer','scissors')
wins=0
losses=0
ties=0
while True:
print('enter your movie:(r)ock,(p)aper,(s)cissors or quit')
playerMove=input()
if playerMove=='q':
sys.exit()
if playerMove=='r' or playerMove=='p'or playerMove=='s':
break
print('any one type r,p,s,q')
if playerMove=='r':
print('Rock verses')
elif playerMove=='p':
print('paper verses')
elif playerMove=='s':
print('scissors verses')
randomNumber=random.randint(1,3)
if randomNumber=='1':
computerMove='r'
print('Rock')
elif randomNumber=='2':
computerMove='p'
print('paper')
elif randomNumber=='3':
computerMove='s'
print('scissor')
if playerMove==computerMove:
print('it is ties')
ties=ties+1
elif playerMove=='r' and computerMove=='s':
print('you wins')
wins=wins+1
elif playerMove=='s' and computerMove=='r':
print('you losses')
losses=losses+1
name=''
print('what is your name')
while True:
print('please enter your name')
name=input()
print(name)
for i in range(4):
print(i)