# Κέντρο Ανοικτών Διαδικτυακών Μαθημάτων Mathesis των Πανεπιστημιακών Εκδόσεων Κρήτης (ΠΕΚ) # http://mathesis.cup.gr # # Εισαγωγή στην Python Διδάσκων Καθ. Νίκος Αβούρης # http://mathesis.cup.gr/courses/course-v1:ComputerScience+CS1.1+2017_T2/about # Εβδομάδα 2η - Μάθημα 11ο - Αλληλοαξιολόγηση (Άσκηση) # Λύση της εργασίας «Μάντεψε τον αριθμό» # Copyright (C) 2017 Χρήστος Ιωσηφίδης chiossif@yahoo.com # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . import random random.seed() guess=random.randint(1,100) Χ=0; while True: k=input("Δώστε έναν αριθμό από 1 μέχρι 100 [0 για τερματισμό]:") if k.isdigit(): k=int(k) if k>=0 and k<101: Χ+=1 if (k==guess): print("Το βρήκατε σωστά μετά από {} προσπάθειες".format(Χ)) break elif (k>guess and k<=100): print("ΟΧΙ είναι μικρότερος") elif (k>0 and k