Compare commits

..

No commits in common. "fe0b399ded03c579b21fab25d8be2100dbad5d5e" and "8e09d01f970272499308d1cefbae98e18bcfd065" have entirely different histories.

4 changed files with 21 additions and 35 deletions

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$">
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (cube)" project-jdk-type="Python SDK" />
</project> </project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

46
main.py Executable file → Normal file
View File

@ -1,37 +1,21 @@
#!/usr/bin/python3 #!/usr/bin/python3
import random import random
from os import system cube = 'Würfel-Generator\nZum Würfeln die 1 Drücken.'
print(cube.center(54))
cube_ = 'Würfel-Generator\n' def cube():
system('clear')
def main():
while True: while True:
try: try:
print('\x1b[H\x1b[1;14H ', cube_) entry = int(input('1 drücken zum Würfeln.\n'))
entry = int(input('\x1b[H\x1b[B\x1b[B1 drücken zum Würfeln.\n2 drücken zum beenden.\n')) #entry = int(entry)
print('\n') return entry
if entry == 1: break
system('clear')
print('\x1b[8;12HDu hast eine \x1b[1;33m%d\x1b[1;0m gewürfelt' % random.randint(1, 6))
elif entry == 0 or entry > 2:
print('\n')
system('clear')
print('\n\n\n\n')
print('Ups! Da wurde nicht 1 oder 2 gedrückt.\nBitte nochmal versuchen.')
elif entry == 2:
print('\n')
system('clear')
print('Danke für\'s würfeln.\nBis Bald!\n')
input('Enter zum schließen.\n')
exit()
except ValueError: except ValueError:
print('\n') print('Ups! Keine Zahl eingegeben. Bitte nochmal versuchen.\n')
system('clear')
print('\n\n\n\n')
print('Ups! Da wurde nicht 1 oder 2 gedrückt.\nBitte nochmal versuchen.\n')
cube()
if __name__ == "__main__": while cube() == 1:
main() print(random.randint(1, 6))
#print('1 drücken um erneut zu würfeln')
else:
print('alles andere')