How to Create a Command Line Multiplication Times Table using a While Loop and a For Loop in Python

  Рет қаралды 167

DJ Oamen

DJ Oamen

Күн бұрын

Пікірлер: 2
@nikhuge6580
@nikhuge6580 28 күн бұрын
can u do a advanced gui project in kivy gui framework
@DJOamen
@DJOamen 27 күн бұрын
Yes, see below: from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.textinput import TextInput from kivy.uix.button import Button from kivy.uix.scrollview import ScrollView class TimesTableApp(App): def build(self): # Main layout container self.layout = BoxLayout(orientation='vertical', padding=10, spacing=10) # Input box for entering a number self.input_box = TextInput(hint_text="Enter a number", multiline=False, input_filter='int') self.layout.add_widget(self.input_box) # Button to generate the times table self.generate_button = Button(text="Generate Times Table") self.generate_button.bind(on_press=self.generate_table) self.layout.add_widget(self.generate_button) # Scrollable area for displaying the times table self.scroll_view = ScrollView() self.result_layout = BoxLayout(orientation='vertical', size_hint_y=None) self.result_layout.bind(minimum_height=self.result_layout.setter('height')) self.scroll_view.add_widget(self.result_layout) self.layout.add_widget(self.scroll_view) return self.layout def generate_table(self, instance): # Clear the previous results self.result_layout.clear_widgets() # Get the input number try: number = int(self.input_box.text) if number < 0: self.result_layout.add_widget(Label(text="Please enter a positive number.")) return # Generate the times table for i in range(1, 13): result = f"{number} x {i} = {number * i}" self.result_layout.add_widget(Label(text=result, size_hint_y=None, height=30)) except ValueError: self.result_layout.add_widget(Label(text="Invalid input. Please enter a valid number.")) if __name__ == "__main__": TimesTableApp().run()
How to Create a Text-to-Speech Calculator in Python
53:59
How I Would Learn Python FAST (if I could start over)
12:19
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
How to Create a Talking Calculator in C#
32:52
DJ Oamen
Рет қаралды 299
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 89 М.
I made Tetris in C, this is what I learned
15:15
Austin Larsen
Рет қаралды 30 М.
Feed Your OWN Documents to a Local Large Language Model!
18:53
Dave's Garage
Рет қаралды 350 М.
How to Create an IQ Test Application in Python
18:09
DJ Oamen
Рет қаралды 194
How to Remember Everything You Read
26:12
Justin Sung
Рет қаралды 3,2 МЛН
How a Russian student invented a faster multiplication method
18:48
BASIC Calculus - Understand Why Calculus is so POWERFUL!
18:11
TabletClass Math
Рет қаралды 1 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 321 М.