Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated method 2 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Easy-ones/User-input-to-Number.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Take two inputs from the user. One will be an integer. The other will be a float
Use input. By default, input gives you a string. Then use int and float to convert the input to a number. And then multiply them. That’s it.

## Solution
## Method 1-
```python
int_text = input("Give me an integer number: ")
int_num = int(int_text)
Expand All @@ -18,7 +19,13 @@ float_num = float(float_text)
result = int_num * float_num
print("Your result is: ", result)
```

## Method 2-
```python
int_num = int(input("Give me an integer number: "))
float_num = float(input("Give me a float number: "))
result = int_num * float_num
print("Your result is: ", result)
```
**[Try it on Programming Hero](https://play.google.com/store/apps/details?id=com.learnprogramming.codecamp)**

## Shortcut
Expand Down