SycroX Posted October 25, 2019 Share Posted October 25, 2019 (edited) import random Students = { } class ID_SYSTEM: Used_Ids = [ ] def generate_new_id ( ): id = random.randint ( 1900000 , 1999999 ) if id in Used_Ids: generate_new_id ( ) else: return id def remove_id ( id ): if id in Used_Ids: list.remove ( id ) def count_id ( ): count = 0 for _ in Used_Ids: count += 1 return count def Add_New ( to_be_added ) to_be_added = str ( to_be_added) last_index = -1 for x in Students: last_index += 1 Students[last_index] = [ ID_SYSTEM.generate_new_id ( ) , to_be_added ] Add_New ( 'RONTGEN' ) لما استعمل وظيفه Add_New كلمه RONTGEN ما تنضاف لللائحه و يقلي خطا في سطر Students[last_index] = [ ID_SYSTEM.generate_new_id ( ) , to_be_added ] انا مااشوف خطا صراحه فاذا احد يقدر يساعد Edited October 25, 2019 by #x1AhMeD-09 Link to comment
MrBiG Posted October 26, 2019 Share Posted October 26, 2019 شوف اخوي https://www.dreamincode.net/forums/forum/29-python/ سجل في هذا الموقع في ناس محترفين بجميع اللغات ويساعدو ( عددهم كثير) واطرح مشكلتك افضل من هنا 1 Link to comment
SycroX Posted October 26, 2019 Author Share Posted October 26, 2019 15 minutes ago, MrBiG said: شوف اخوي https://www.dreamincode.net/forums/forum/29-python/ سجل في هذا الموقع في ناس محترفين بجميع اللغات ويساعدو ( عددهم كثير) واطرح مشكلتك افضل من هنا مشكور بس خلاص حليتها المشكله كان في تعريف المتغيرات نسيت احط global 1 Link to comment
#Sn[i]pêŘ Posted November 5, 2019 Share Posted November 5, 2019 ما اعتقد انو في احد رح يساعدك هنا لانو كلهم يستعملون java و php اذا تبغى مساعدة في البايثون سجل في هاذ الموقع انا كنت استعمله https://teamtreehouse.com/community Link to comment
#Mr.Pop Posted December 26, 2019 Share Posted December 26, 2019 Students = { } # it's a dist Students[last_index] = [ ID_SYSTEM.generate_new_id ( ) , to_be_added ] # its a list Students[last_index] = { ID_SYSTEM.generate_new_id ( ) , to_be_added } # its a list Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now