O'Reilly Forums: Chapter 1 Game P 33 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 1 Game P 33 Trying to optimize code

#1 User is offline   muzima 

  • New Member
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 21-December 13
  • Gender:Male
  • Location:Moscow,Russia
  • Interests:Snowboarding, classical music, Greek language. I'd like to learn how to create apps for my Android. Aim - creating app for my Greek dictionary by my own.

Posted 21 December 2013 - 07:20 AM

I tried to optimize the code and to delete

if guess == secret:
print("You win!")

.

The result is:

print("Привет Welcome")

from random import randint
secret = randint(1,10)

guess = 100

while guess != secret:
g = input
("Введи правильное число Input a right number")
guess = int(g)
if guess < secret:
print
("Введи число побольше Input higher number")
else:
if guess > secret:
print
("Введи число поменьше Input lower number")

print
("На этот раз игра закончена, Ты победил! The game is over, you are win")


Can I say, that I have optimized my code?

As I see, I can use Russian words to create variables. How can I know, what other languages are available for use?

This post has been edited by muzima: 21 December 2013 - 07:28 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users