Lotto first commit
This commit is contained in:
commit
7bb6a06376
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
Lotto
|
10
.idea/Lotto.iml
generated
Normal file
10
.idea/Lotto.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (übungen)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (übungen)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Lotto.iml" filepath="$PROJECT_DIR$/.idea/Lotto.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
84
main.py
Executable file
84
main.py
Executable file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/python3
|
||||
import random
|
||||
|
||||
run = True
|
||||
|
||||
|
||||
def lotto():
|
||||
numbers = []
|
||||
supernum = []
|
||||
for i in range(1, 7):
|
||||
numbers.append(random.randint(1, 49))
|
||||
numstr = [str(x) for x in numbers] # Hier wird mit list comprehension die Integer in String umgewandelt.
|
||||
supernum.append(random.randint(0, 9))
|
||||
print(numstr, " Superzahl: ", supernum)
|
||||
|
||||
|
||||
def euro_jack():
|
||||
numbers = []
|
||||
supernum = []
|
||||
for i in range(1, 6):
|
||||
numbers.append(random.randint(1, 50))
|
||||
numstr = [str(x) for x in numbers] # Hier wird mit list comprehension die Integer in String umgewandelt.
|
||||
supernum.append(random.randint(1, 12))
|
||||
supernum.append(random.randint(1, 12))
|
||||
print(numstr, " Eurozahlen: ", supernum)
|
||||
|
||||
|
||||
def counts_lotto(uentry):
|
||||
for p in range(uentry):
|
||||
print()
|
||||
print("6 aud 49")
|
||||
lotto()
|
||||
|
||||
|
||||
def counts_jack(uentry):
|
||||
for p in range(uentry):
|
||||
print()
|
||||
print("5 aus 50")
|
||||
euro_jack()
|
||||
|
||||
|
||||
def main():
|
||||
global run
|
||||
while run:
|
||||
try:
|
||||
user = input("1 für Lotto 6 aus 49\n2 für Euro Jackpot\nMit q Programm beenden.\n")
|
||||
if user == "q":
|
||||
print("Bis bald...")
|
||||
break
|
||||
if user == "1":
|
||||
uentry = input("Wieviele Ziehungen ?\nMit q Programm beenden.\n")
|
||||
if uentry == "q":
|
||||
print("Bis bald...")
|
||||
break
|
||||
try:
|
||||
uentry = int(uentry)
|
||||
counts_lotto(uentry)
|
||||
run = False
|
||||
|
||||
except ValueError:
|
||||
print("Bitte nur Zahlen eingeben!\n")
|
||||
|
||||
elif user == "2":
|
||||
uentry = input("Wieviele Ziehungen ?\nMit q Programm beenden.\n")
|
||||
if uentry == "q":
|
||||
print("Bis bald...")
|
||||
break
|
||||
try:
|
||||
uentry = int(uentry)
|
||||
counts_jack(uentry)
|
||||
run = False
|
||||
|
||||
except ValueError:
|
||||
print("Bitte nur Zahlen eingeben!\n")
|
||||
|
||||
elif user != "1" or user != "2":
|
||||
print("Bitte nur 1 oder 2 eingeben!\n")
|
||||
|
||||
except ValueError:
|
||||
print("Bitte nur Zahlen eingeben!\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user