T
T
Taras Dushenko2020-05-19 13:41:01
Python
Taras Dushenko, 2020-05-19 13:41:01

I don't understand what is wrong?

import random
class r:
  a=random.radiant(0,9)
  b=random.radiant(0,9)
  c=random.radiant(0,9)
class vvid:	
  l=input('Перше число')
  p=input('Друге число')
  z=input('Третє число')
class perevirka:
  if r(a==l):
    print('Ви вгадали перше число')
  else:
    print("перше число не вгадане")
  if r(b==p):
    print('Ви вгадали друге число')
  else:
    print('Друге число не вгадане')
  if r(c==z):
    print('Третє число вгадане')
  else:
    print('Третє чсло не вгадне') 
<code>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0ralo, 2020-05-19
@0ralo

And what is the point? Assignment to a variable in a class, you do not create class instances +

if r(c==z): - не видел никогда такого
    print('Третє число вгадане')

M
Mikhail Ustinov, 2020-05-19
@Gggggbot

I didn’t study the whole code, but I say right off the bat,

a = random.randint(0,9)
  b = random.randint(0,9)
  c = random.randint(0,9)
radiant there is no such)
Classes are not declared at all. To be honest, I didn’t understand them myself (because I scored on python), but I offer a different version of the code:
import random
a = random.randint(0,9)
b = random.randint(0,9)
c = random.randint(0,9)

l=input('Перше число: ')
p=input('Друге число: ')
z=input('Третє число: ')

if a == l:
  print('Ви вгадали перше число')
else:
  print("перше число не вгадане")
if b == p:
  print('Ви вгадали друге число')
else:
  print('Друге число не вгадане')
if c == z:
  print('Третє число вгадане')
else:
  print('Третє чсло не вгадне')
In general, there are a lot of mistakes and there are things that are not needed here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question